Showing posts with label Launcher. Show all posts
Showing posts with label Launcher. Show all posts

Sunday, 28 April 2024

Model Rocket Launcher WiFi ESP8266 Part 3

Introduction 
This blog continues from Part 2 of the ‘Wi-Fi-controlled rocket launcher’. In this blog, the software changes to suit the ESP8266 are mentioned. Additionally, a mechanical 'proof of concept' for the rocket launcher is shown using a 3D-printed case.

Bench Test of Rocket Launcher
Bench Test of Rocket Launcher

Code Change Summary
In the earlier version of the model rocket launcher design, a PSoC microcontroller with Bluetooth was selected for communications. When moving to the ESP8266, the Bluetooth communications interface was changed to a Wi-Fi interface. Using a Wi-Fi interface simplified the design when compared to developing in Android Studio.

To support a broader audience using the ESP8266, it was decided to perform software development using the Arduino platform.

/** *****************************************************************************
* @file   main.c
* @version 1.0b
* @date 10/02/2024
* @brief
* 01/03/2023  Moved code from original PSoC version into Arduino
* 13/01/2024  Changed code operation, updated launch state machine
* 24/01/2024  Client connection issues noted during testing
* 10/02/2024  Code cleanup. Changed deprecated server.available() to server.accept()
****************************************************************************** */

#if !defined(ESP8266)
  #error For ESP8266. Check Tools->Board setting
#endif

/*_TIMERINTERRUPT_LOGLEVEL_ from 0 to 4 */
#define TIMER_INTERRUPT_DEBUG         1
#define _TIMERINTERRUPT_LOGLEVEL_     1
#define ENABLE_DEBUG_PRINTS           true

Most parts of the original code from the PSoC, including the launcher state machine, were either updated or rewritten. Code changes were needed for the ESP and targeted toward proper encapsulation.

ITimer.attachInterruptInterval(TIMER_INTERVAL_MS * 1000,TimerHandler);  /* 10 ms system timer */
      

Snippets and libraries from the Arduino community were included in the new launcher code. Specifically, credit goes to Khoi Hoang for Timer Interrupt examples and Martyn Currey for ESP Wi-Fi implementation.

How Software Was Developed
The code was developed using the Arduino IDE. Initial testing for the ESP code was performed using a Windows laptop for the Wi-Fi connection primarily to test the webpage interface. Testing subsequently progress to  an Android phone.

Shown in the image below is the first rocket launcher web page. Additional information such as battery voltage and launch state may be included on the web page in later updates.

Rocket Launcher Webpage
Rocket Launcher Webpage
 

Launcher Case
After reviewing the previous enclosure and cost, it was decided to design a 3D-printable enclosure to house a small lead acid battery and a control board. The lead acid battery is only temporary and will be changed to an 18650-cell(s) capable of a high-discharge current.

For the 3D-printed case, two mechanical parts were drafted in Fusion 360. These parts comprised of a base and a lid as pictured below.

Rocket Launcher Case (Fusion 360)
Rocket Launcher Case (Fusion 360)
 

Launcher Hardware Assembly
With the ESP code allowing the desired launch operation, the circuit board, wiring and battery were assembled and added to the 3D-printed case.

Rocket Launcher Test Assembly
Rocket Launcher Test Assembly

During the assembly, it was noted that the pluggable circuit board headers, although simple to install and use, were expensive and consumed space. On the subsequent revision of the board, as displayed below, the pluggable headers were replaced with through-hole solder pads that suit a larger gauge wire.

Updated Launcher Board
Updated Launcher Board

Additionally, the toggle switch used for controlling the power was salvaged from another project. There are no manufacturer markings on the switch to generate a Bill of Materials. More clearance was added around the toggle switch body to suit other types of toggle switches such as the model shown below.

Standard Toggle Switch
Standard Toggle Switch

Complete Test Assembly
For a bench test, a lamp was used as the igniter as pictured below. A short video of the operational launcher is exampled in the video.


The next post will feature the updated launcher circuit board and field testing.

Sunday, 22 October 2023

Model Rocket Launcher WiFi ESP8266 Part 2

Introduction 
This blog continues from Part 1 of the WiFi-controlled rocket launcher. In this short post, load testing was performed on the igniter's power supply and the output drivers.

WiFi Rocket Launcher Blank PCB
WiFi Rocket Launcher Blank PCB

Power Supply
The DC-DC converter, Texas Instruments part LMR50410, was tested for switch ON voltage threshold and response. Since the converter powers an ESP module and output drivers for the igniter, the load current test was set for 300 mA.

Power Supply Portion of WiFi Rocket Launcher
Power Supply Portion of Rocket Launcher

An external power supply was connected to the launcher board. The voltage was increased in increments of 100 mV until the converter activated. For this board, the threshold was 4.1 V. The output switch ON waveform is shown below.

Rocket Launcher Power Supply Supply Turn ON
Rocket Launcher Power Supply Supply Turn ON

A resistive load resulting in 330 mA was connected to the 3.3 V supply for testing. The output voltage dropped from 3.3 V to 3.28 V when the load was connected.

Rocket Launcher Power Supply Supply Transient Response
Rocket Launcher Power Supply Supply Transient Response

The transient response for the power supply was measured for a 50 % load change. Captured in the image above is the response showing a recovery time of less than 200 ns for the supply voltage to settle back to 50 mV.

Output Drivers
The output driver circuit design had been established from the previous version of the launcher circuit board, which meant the operation was already known.

Rocket Launcher Output Driver Load Testing
Rocket Launcher Output Driver Load Testing

To test the output drivers on this board, a 5 Ω resistive load was used. The two output drivers were powered with 12 V to simulate the primary power source. Using the 3.3 V from the converter, the two drivers were activated.
V(supply) = 11.92 at drivers no load, V(supply) reduced 11.79 V with approximately 2.3 A load current because of cable losses.

Measurements were taken with 2.3 A of load current
V(load) = 11.19 V
V(diode) = 401 mV
V(high side driver) = 102 mV
V(low end driver) = 124 mV

In par
t 3, the code for the rocket launcher will be started in Arduino IDE.

Saturday, 24 June 2023

Model Rocket Launcher WiFi ESP8266

Introduction
This blog follows the redesign and development of a model rocket launcher controller that features WiFi communications to control the launch process. This design uses an ESP-based microcontroller module. The Arduino platform was chosen for code development.

Rocket Launcher 3D Model
Rocket Launcher 3D Model

Redesign
To control the launch in the previous model rocket launcher design, Bluetooth communications were used between a PSoC microcontroller and an Android phone. The interface was changed to WiFi to remove the need for developing a phone application. Controlling a rocket launch through WiFi would be independent of a phone or computer operating system.

WiFi Module
For the launcher redesign, an off-the-shelf ESP module capable of WiFi was chosen from Adafruit. The ESP module was chosen for a few reasons. Firstly, the module’s price was relatively low (USD 10). The module was readily available compared to other dedicated microcontrollers. Lastly, using an ESP module meant that the rocket launcher design could be migrated more easily to other ESP devices.

Adafruit Huzzah ID 2471 (Courtesy Adafruit)
Adafruit Huzzah ID 2471 (Courtesy Adafruit)

Reused Design
The same section of circuit responsible for driving the rocket engine igniter was taken from the previous design. This section consisted of high (VN7040) and low-side (VNL5030) switching drivers (ST Microelectronics).

Rocket Launcher Igniter Drive Circuit
Rocket Launcher Igniter Drive Circuit

Circuit Updates
To begin the schematic update process, the ESP module was created in the schematic libraries. The new part replaced the previous PSoC microcontroller and associated circuitry.

The Altium PCB model was downloaded from the website SnapEDA.

Capture of Adafruit Huzzah PCB Footprint from SnapEDA
Capture of Adafruit Huzzah PCB Footprint from SnapEDA

Schematic Updates
On the ESP module schematic page, the power supply connections and ST driver control signals were mapped to the ESP.

Rocket Launcher - Huzzah Circuit Connections
Rocket Launcher - Huzzah Circuit Connections

Audible notification of an impending launch was retained using the buzzer. Connections were mapped to the ESP.

Rocket Launcher - Buzzer
Rocket Launcher - Buzzer


The display (LCD) was infrequently used in the previous design so it was removed and replaced with an LED.

The launch button input to the ESP module was retained for testing purposes.

Rocket Launcher - Optional Launch Button
Rocket Launcher - Optional Launch Button

Connections were made to ESP module pins that had no special functions.
 
Output Drivers

Schematic changes were made to the ST output driver’s power supply. This was required to match the ESP module’s DC 3.3 V supply voltage. The feedback monitoring from the ST drivers was removed from the design because of the reliable performance of the ST drivers.

Power Supply
A DC-DC step-down converter was retained for the power supply. Texas Instruments part LMR50410 featuring an integrated diode was selected to replace the previous DC-DC converter.

Another benefit of the DC-DC converter is its operating voltage which is wider than the ESP modules linear regulator (LDO). The LDO has a maximum rated input voltage of DC 6 V. This voltage does not suit all battery chemistry types.

Rocket Launcher - Power Supply
Rocket Launcher - Power Supply

Battery voltage monitoring using the ADC on the ESP through a resistor divider was kept for experimentation and possible future use.

Circuit Board
There were no caveats defined for the shape of the circuit board (PCB). The placement of components drove the PCB shape. Minimal design constraints for the PCB meant that the PCB was set up for components on both sides.

The capture below shows the PCB top layer with the ESP module, power supply underneath the ESP module, buzzer and optional screw terminals. To fit the power supply beneath the ESP module, pluggable headers were utilised to space the ESP module off the board.

Rocket Launcher PCB - Top Layer
Rocket Launcher PCB - Top Layer

The next capture below shows the PCB bottom layer containing the output switching drivers and related components.

Rocket Launcher PCB - Bottom Layer
Rocket Launcher PCB - Bottom Layer

Four PCB layers were used for the launcher board stack-up. Captures of the two internal power planes have not been shown.

After component placement and routing, the board size reached a comfortable size of 62 x 44 mm. On the longest PCB axis, a set of 3 mm strips were added to suit mounting in an enclosure. Pictured below is a 3D side and rear view of the board.

Rocket Launcher - 3D Side View
Rocket Launcher - 3D Side View
Rocket Launcher - 3D Rear View
Rocket Launcher - 3D Rear View

In part 2 of the launcher blog, the PCB construction and initial testing will be performed.

Sunday, 29 November 2020

Model Rocket Launcher Bluetooth Android Part 2

Summary
This blog details hardware and code changes to the Bluetooth PSoC Model Rocket Launcher for monitoring battery voltage and current. The current monitoring output provided by the high side switching device was measured and calibrated using multi-point characterisation in the launcher’s PSoC controller.

Purpose of Monitoring
Under-voltage battery monitoring was included to minimise the chance of battery over-discharge. The battery voltage for a
25% State of Charge (SoC) was used as a reference in the rocket launcher firmware.

Measurement and monitoring of the current drawn by the igniter were included to check the recommended all-fire current of 2 A (Estes forum) was reached during a launch.

Battery Voltage
A hardware connection for monitoring the battery voltage, using a Cypress PSoC ADC input, was not part of the initial circuit board design (PCB).

Rocket Launcher PCB with Strapped Battery ADC Input
Rocket Launcher PCB with Strapped Battery ADC Input

As the PCB included hardware for a voltage divider across the batter, a connection was required to a spare PSoC pin with ADC capability. In the image above a wire was strapped from the voltage divider to the ADC input.

Launcher Battery Voltage Divider
Launcher Battery Voltage Divider

The resistor values selected for the voltage divider were changed to use values already available in the design. Assuming a battery charged to 13.8 V, the voltage at the ADC input, taking into account the loss in the reverse protection Schottky diode D6, was approximately 2.4 V.

For the PSoC SAR ADC reference voltage, the VDDA supply pin on the PSoC was used.

It should be noted that the battery voltage measurement was for indicative purposes only. To improve ADC measurement accuracy, the ADC reference voltage could be changed to utilise the PSoC internal 1.024 V reference. Adjustment to the battery voltage divider would be required.

Launcher SAR ADC Configuration
Launcher SAR ADC Configuration

Igniter Current
The high side switching device (VN7040) features an output which provided a voltage representation of the current measured by the VN7040. A
PSoC ADC input was used to measure the voltage.

Launcher Battery Current Sense Output
Launcher Battery Current Sense Output (MSense)

The value of the resistor connected to the output of the high side switch (MSense) was reevaluated to suit an Estes igniter. Assuming losses in the circuit such as cabling (resistive), reverse protection diode forward voltage (477 mV @ 15A), the high (40 mR) and low side (30 mR) switching devices MOSFET resistances. A full charged lead-acid battery driving an igniter (Estes 800 mR) with the resistive losses should result in a current of slightly over 10 A.

VN7040 K-Factor vs Isense Response (Courtesy ST)
VN7040 K-Factor vs Isense Response (Courtesy ST)

As the operating current was expected to be above 4.5 A, the K factor of 1340 was selected from the VN7040 datasheet.

VN7040 Current Sense K Factor > 4.5 A
VN7040 Current Sense K Factor > 4.5 A

There were two caveats for calculating the current sense resistor value. Firstly, under normal operating conditions the voltage generated across the current sense resistor should be less than the ADC maximum voltage. For the existing design, the SAR ADC reference voltage was 5 V so this was not a primary concern. The maximum voltage should be reviewed if the ADC reference voltage was changed to 1.024 V. Secondly, the maximum current output by the sense output (MSense) of the high side switches was listed as 10 mA.

VN7040 Current Sense Output Max Operating Characteristics
VN7040 Current Sense Output Max Operating Characteristics

Selecting a current of 10 A and a nominal k factor of 1340, the formula shown in Table 11 of the VN7040 data sheet was applied.

VN7040 Truth Table with Current Sense Formula
VN7040 Truth Table with Current Sense Formula

Applying the formula shown in the truth table pictured above, an Isense value of 7.46 mA was yielded.

VN7040 Isense Calculation
VN7040 Isense Calculation

With a maximum ADC reference voltage of 5 V, a 590 R resistor was selected. The maximum voltage at the PSoC ADC pin, being the product of the Isense value and the resistor value, gave approximately 4.4 V.

ADC Configuration
The SAR ADC was configured for two channels, 12-bit with a conversion time of approximately 2 ms.

PSoC SAR ADC Setup
PSoC SAR ADC Setup

The results from the SAR ADC, battery voltage and current sense (voltage), were converted into millivolts.

static uint16_t    adc_result_multiplier     = 23u;
static uint16_t    adc_result2_multiplier    = 554u;
static uint16_t    adc_result_divider       = 10u;
static uint16_t    adc_result2_divider   = 100u;
static uint16_t    adc_result_trim      = 154u;

adc_result1 = ADC_SAR_CountsTo_mVolts(0,ADC_SAR_GetResult16(0));
adc_result2 = ADC_SAR_CountsTo_mVolts(1,ADC_SAR_GetResult16(1));
adc_voltage_result = (adc_result2 * adc_result2_multiplier)/adc_result2_divider;
adc_current_result= ((adc_result1 * adc_result_multiplier)- adc_result_trim)/adc_result_divider;

To calibrate the PSoC ADC current measurement, a multi-point characterisation was performed. Various resistive loads were used in place of the igniter and the ADC result recorded.

PSoC ADC Raw Data from Resistive Loads with Power Supply
PSoC ADC Raw Data from Resistive Loads with Power Supply

The ADC result was output on the serial port. ADC results were plotted against the measured current to produced the graph displayed below.

Measured Current vs PSoC ADC Voltage for Various Resistive Loads
Measured Current vs PSoC ADC Voltage for Various Resistive Loads

ADC Data Serial Output
The ADC results were output on the Rocket Launcher serial port. The data was transmitted at a rate of 921,600 baud to an Android phone which was running the application Serial USB Terminal. Written by Kai Morich, the application was one of the few which supported higher baud rates and was stable at that data rate.

Serial USB Terminal Android Application Landing Screen
Serial USB Terminal Android Application Landing Screen

Shown in the capture above is the Android phone application. Connection of a USB to TTL adaptor from the launcher to the Android phone was achieved using an On The Go (OTG) adaptor cable.

Serial USB Terminal Android Application Settings Screen
Serial USB Terminal Android Application Settings Screen

Configuration for the 921,600 baud rate was achieved through the settings tab in the application.

Serial data was captured for two supply types, the first a benchtop Rigol linear power supply and the second a lead-acid battery (1.2 AH).  The graph shown below provides the ADC measurement plotted against various resistive loads.

PSoC ADC Voltage vs Resistive Load
PSoC ADC Voltage vs Resistive Load

Bench testing with resistive loads showed that ADC measurements were stable. The graph below shows the ADC current measurement when testing with a 5 R load.

PSoC ADC Voltage Samples for Resistive Load of 5R
PSoC ADC Voltage Samples for Resistive Load of 5R

Low Battery and Current Error States
The ADC result from the battery voltage measurement was compared to a threshold of 12 V for the under-voltage detection. Similarly, for the under-current detection, the current measurement was compared a value of 0.558 V which represented approximately a current of 2 A.

    
if (SYSTEM_FLAGS_ADC.adc_has_result == true)
{   
/* Order of execution sets priority */
    if (adc_voltage_result < under_voltage_compare)
    {
        Error_State = under_voltage;
    }
    else if (adc_current_result < under_current_compare)
    {
        Error_State = under_current;
    }
}

OLED Screen Update
Additional error states relating to the low battery voltage and low igniter current were added to the rocket launcher firmware.

The OLED screen below was shown after the rocket launch cycle if the battery voltage fell below 12 V during the launch.

Rocket Launcher OLED Low Battery Screen
Rocket Launcher OLED Low Battery Screen

For the low current, the screen below was displayed after the rocket launch cycle, if the measured current fell below approximately 2 A during the launch.

Rocket Launcher OLED Low Current Screen
Rocket Launcher OLED Low Current Screen

Field Testing
Field rocket launches were performed to capture ADC results with Estes igniters. There were multiple events which caused the ADC results to vary of which some events were intrinsic to the igniter behaviour during a launch.

The graph below represents one of the instances where the launch of the rocket was successful however, the igniter wires shorted moments after liftoff. The constant current draw of the shorted wires is represented by the constant high from time 53 s.

Rocket launcher igniter current toggling at start
Rocket Launcher Igniter Current Toggling

Field Launches
Below are snippets from recent launches.

Estes Curvilinear model rocket with standard size A engine.

Estes Fat Boy model rocket with standard size A engine.

Unbranded model rocket.


Final Thoughts
The hardware and firmware updates performed to the rocket launcher provided additional features and monitoring. Specifically, monitoring the igniter current provided insight into the different events and responses which can occur to the igniter on the launchpad. In a future release, a scheme for current monitoring would involve the development of the firmware to handle the various igniter responses.

Downloads
The
updated firmware for the PSoC launcher project.

Rocket Launcher PSoC Project rev 1.03
Rocket Launcher PSoC Project rev 1.03