STAR Public
  • Space Technologies and Rocketry
  • Quick Links
  • Member Info
    • Membership Requirements
    • Elections
  • Current Projects
    • ALULA: First Leap
      • Project Objectives
      • High-Level System Parameters
      • Propulsion
      • Avionics
      • Airframe
      • Recovery
    • Caldera: IREC 2024
      • Airframe
      • Avionics
      • Airbrakes
      • Recovery
      • Staging
      • KELSE-Y (Payload)
  • Previous Projects
    • CalVistor: IREC 2023
      • Recovery (CalVistor)
      • Airframe (CalVistor)
      • Airbrakes (CalVistor)
      • Payload (CalVistor)
    • ELLIE
      • ELLIE Overview
      • Timeline
      • Physical System
      • Electrical and Software
      • Ongoing Research
    • MINDI
      • Airframe
      • Recovery
    • PinkBeary
      • Altimeter Wiring Update
      • Airframe Diameter
      • Fin Sizing
      • Pyro Bolts
      • Electronics
    • CAS
      • CAS Overview
      • Core Module
      • Radio Module
      • Pyro Module
      • Prop Module
      • CAS Core Revised
      • CAS Radio Revised
    • DAVE
      • Summary of DAVE
      • FAQ's
      • DAVE Blog
    • Bear Force One: IREC 2020/2021
      • Airframe
      • Recovery
        • Parachute Harness
        • Avionics Bay
          • Avionics Bay Glossary
          • Avionics Bay Assembly
        • Black Powder Holders
        • Payload
          • Payload Subsystem Report
          • IRIS
            • Peripherals Diagram
            • Pinout Diagram
            • Power Flow Diagram
          • MFC (2020)
          • Stabilization
          • Structures
          • Cameras
          • Muons - Archived
          • IRIS Legacy - Archived
    • Arctos
    • AirBears
  • Frequently Asked Questions
  • Tutorials
    • Media
      • How to make a decent video
    • RFS Safety Training
    • Submitting Reimbursements
    • Software Setup
      • SolidWorks Installation
      • VMware/Boot Camp setup
      • [In-Progress] SolidWorks PDM Setup
      • ANSYS Installation and Setup
      • Solidworks Assemblies Basics
      • OpenRocket Installation
      • Deprecated Software
        • [deprecated] Getting Started With GrabCAD Workbench
        • [deprecated] Using GrabCAD Workbench in SolidWorks
        • [deprecated] Connecting to CalSTAR's Server
        • [deprecated] Installing and Licensing Converge CFD
    • General Tutorials
      • How to Use SolidWorks Templates
      • [In Progress] Digikey Ordering Guide
      • SolidWorks Training Session
      • SolidWorks Training Tutorials
    • Enery Systems
    • Manufacturing
      • Material Properties and Uses
      • 3D Printing (FDM)
      • Laser Cutting
      • FabLight: Metal Laser Cutter
      • Milling
        • Othermill
        • [Empty] Manual Mills
      • Tolerancing
      • Fasteners
      • Suppliers
      • Composite Materials and Best Practices
      • 8020 Extrusions
    • Airframe
      • Airframe Components
      • Tube Attachement
      • OpenRocket
      • Tube Winding
      • Sizing Fins
      • Attaching Fins
      • Rail Buttons
      • Motor Retention
      • Painting Rockets
    • Avionics
      • KiCad
      • Git
      • Project Management
      • Firmware Development Environment
      • Ground Station Software
      • Intro to Embedded C Programming
      • Schematic and Layout Review
      • Board Design Reference
      • Using Lab Equipment
      • Reflow Oven
      • Soldering
      • Debugging Tips/Testing
      • Ham Radio Basics
      • Component Selection
      • High Temperature Batteries
    • Outreach Activities
      • Straw Rocketry
      • Spacecraft Structures
      • Alka Seltzer Rockets
      • Paper Airplane Launcher
      • Coding Workshop
    • Operations
      • SolidWorks file conventions
      • Style Guidelines
      • LaTeX
    • Payload
    • Propulsion
      • Feed System Types
      • Rocket Propulsion Analysis Tutorial
      • Ignition Devices
      • Creating a Piping and Instrumentation Diagram P&ID
      • Pipes, Fittings, and Components
      • Injectors
    • Recovery
      • Parachute Sizing
      • Avionics Sled
      • [in progress] Altimeters
      • Wire Design and Routing
    • Simulations
      • FEA Simulation Tutorial using ANSYS
      • Getting Started with CONVERGE (2.4)
      • [Empty] Simulation Methods
      • Mathematical Models
      • SimScale
        • SimScale 3D CFD
      • Using ANSYS
      • ANSYS 19.2 2D CFD Tutorial
      • ANSYS 19.2 3D CFD Tutorial
    • Administrative
      • Azure Server
    • Page 1
  • Reference
    • Reference
    • Glossaries
      • Propulsion
      • Common Acronyms and Definitions
    • Brand Guidelines
    • Legal
    • High Power Rocketry (HPR)
      • NASA HPR Reference
      • L1 and L2 Certification Tips & Tricks
      • HPR Kits
      • HPR Design
      • HPR Suppliers
      • STAR HPR Certification
    • Ham Operators
    • X-Winder Update Log
    • Safety
      • Materials
      • Tools
      • Electrical
      • Range Safety
  • Testing
    • Test Forms
    • Damage Report Forms
    • Airframe Tests
    • Recovery Tests
      • Ground Ejection Test
  • Onboarding
    • Intro Projects
      • Airframe
      • Avionics
        • PCB Design Mini-Project
      • Operations
      • Payload
      • Propulsion
      • Outreach
      • Recovery
      • Media
      • Safety
      • Simulations
      • Old Intro Projects
        • Payload 2020 Intro Project
        • Propulsion Fall 2019
        • Avionics 2018
        • Recovery 2018
        • Avionics (new intro project Fall 2021)
  • Project Management
  • History of the Team
    • Early Years
    • Executive History
    • Launch History
      • 2022-12-03 MINDI First Flight
      • 2022-09-17 Pinkbeary First Flight
      • 2019-11-16 AirBears First Flight
      • 2018-03-24 Final flight for Arktos
      • 2017-04-08 Competition Launch, NASA SL 2017
      • 2017-03-25 FRR Re-Re-Flight, NASA SL 2017
      • 2017-03-12 FRR Re-Flight, NASA SL 2017
      • 2017-03-04 FRR Flight, NASA SL 2017
      • 2016-12-04 CDR Subscale Flight, NASA SL 2017
    • Fleet
  • How to use GitBook
Powered by GitBook
On this page
  • Flow control
  • Hot-fire sequence design
  • Code Implementation
  • Data acquisition and processing
  • Automation in calibration
Export as PDF
  1. Previous Projects
  2. ELLIE

Electrical and Software

PreviousPhysical SystemNextOngoing Research

Last updated 1 year ago

Flow control

Hot-fire sequence design

The team is required to stay in the bunker during a hot fire, so the engine must be controlled remotely. We chose to use two ESP32s, one of which would send commands (), and the other would report data (DAQ Board). Both devices were constructed as state machines, with COM Board connected to the computer to transmit the data reported by the DAQ Board.

Here is a state machine diagram to visualize the communication:

Explanation of the State Machine

After the initial start-up, the COM board first goes into state 0, then settles in state 1. It instructs the DAQ board to enter state 1 and only poll for data at a relatively slow rate (about 1 data point per second). The COM Board and DAQ board lights would flash when a data packet is successfully sent or received.

When button 1 is pressed, the COM board enters state 3, the armed state. The DAQ board receives the command to change state and moves to state 3 as well. Both the COM and DAQ lights become solid to indicate the state change. Here the poling occurs more frequently, and the system is ready to execute the hot-fire stages.

After button 2 is pressed, ignition occurs. However, no further actions are happening as a visual confirmation of a visible flame is necessary to continue.

Once a visible flame is confirmed, and button 3 is pressed, the COM board enters state 5. The DAQ board, after moving to the same state, enters an automatic process. At this point, instead of commanding, the COM board listens for the status update from the DAQ board.

The DAQ board, at state 5, opens GOX valve and keep the ETH valve closed. After approximately 0.5 second, the board moves to state 6, where both valves are opened. State 7 comes x seconds afterward, x being the planned hot-fire time, and closes the GOX valve. It lasts for another 0.5 second, and transitions into state 8, where both valves are closed. At this point, DAQ resets the state to 0, and pass it back to the COM board, which adjusts the state accordingly. A full hot-fire sequence is complete.

Devices connected to DAQ: 4 PTs (pressure transducers), 1 FM (flow meter), load cells.

Code Implementation

Code Highlights

Since the bunkers and the launch pad are approximately 100 ft apart, using a wired cable between the ESP32s, although reliable and still popular in collegiate teams, was not economically efficient. Instead, we established a wireless connection between the COM and DAQ boards, with an information queue that can hold data while transmitting.

//Define communication structure

typedef struct struct_message {
    int messageTime;
     int pt1;
     int pt2;
     int pt3;
     int pt4;
     int lc1;
     int lc2;
     int lc3;
     int fm;
    unsigned char S1;
    unsigned char S2;
        int commandedState = 0;
        int DAQstate=0;

    unsigned char I;
    short int queueSize;
    int Debug;
} struct_message

The "pts" are the pressure transducers we implemented throughout the engine system, while the "lcs" are load cells for measuring the engine thrust, and fm is the flow meter measurement. For both sending and receiving data, functions and interrupts are set up to handle.

Establishing the data structure for communications:

// Create a struct_message called Readings to recieve sensor readings remotely
struct_message incomingReadings;

// in void setup() we register the for a callback function that will be called when data is received
esp_now_register_recv_cb(OnDataRecv);

void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
 // Serial.print("\r\nLast Packet Send Status:\t");
 // Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");

  if (status == 0){
    success = "Delivery Success :)";
    digitalWrite(INDICATOR2, HIGH);
    receiveTimeDAQ = millis();
  }
  else{
    success = "Delivery Fail :(";
    digitalWrite(INDICATOR2, LOW);
  }

}

// interrupt function, triggered when 
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
  memcpy(&incomingReadings, incomingData, sizeof(incomingReadings));
  incomingPT1 = incomingReadings.pt1;

     digitalWrite(INDICATOR1,HIGH);

// loading the remote data into local variables
  incomingMessageTime= incomingReadings.messageTime;
  incomingPT2 = incomingReadings.pt2;
  incomingPT3 = incomingReadings.pt3;
  incomingPT4 = incomingReadings.pt4;
  incomingFM = incomingReadings.fm;
  incomingLC1 = incomingReadings.lc1;
  incomingLC2 = incomingReadings.lc2;
  incomingLC3 = incomingReadings.lc3;
  incomingS1 = incomingReadings.S1;
  incomingS2 = incomingReadings.S2;
  queueSize= incomingReadings.queueSize;
  incomingI = incomingReadings.I;
  actualState = incomingReadings.DAQstate;
  incomingDebug= incomingReadings.Debug;

// Rest of code omitted
}

In setup(), we need to call the following commands to get everything working:

//initialize ESP32
   if (esp_now_init() != ESP_OK) {
  //  Serial.println("Error initializing ESP-NOW");
    return;
  }
   // Once ESPNow is successfully Init, we will register for Send CB to
  // get the status of Trasnmitted packet
  esp_now_register_send_cb(OnDataSent);

  // Register peer/ second ESP 32
  memcpy(peerInfo.peer_addr, broadcastAddress, 6);
  peerInfo.channel = 0;
  peerInfo.encrypt = false;

  // Add peer
  if (esp_now_add_peer(&peerInfo) != ESP_OK){
 //   Serial.println("Failed to add peer");
    return;
  }
  // Register for a callback function that will be called when data is received
  esp_now_register_recv_cb(OnDataRecv);

The following code is the implementation of the state machine. State cases such as -1, 30, etc. are omited since they are only for testing and debugging purposes. Those states are not a part of the main hot-fire sequence.

//State Machine Implementation
case (0): //Default/idle
      idle();
      state=1;  
    break;

  case (1): //Polling
    polling();

    if ((digitalRead(BUTTON2)==1)||(serialState==2)) { state=3; S1=servo1ClosedPosition; S2=servo2ClosedPosition; SendDelay=pollingSendDelay; }
    if (serialState==18) {state=18;} 
    if (serialState==17) {state=17;} 
    if (digitalRead(PRESS_BUTTON)==30) {state=30;}

    break;

  case (2): //Manual Servo Control

 manualControl();
  if ((serialState==40)) { state=0; SendDelay=pollingSendDelay; }

  break;

  case (3): //Armed
    armed();

    //button to ignition 
    if ((digitalRead(BUTTON3)==1)||(serialState==3)) { state=4; S1=servo1ClosedPosition; S2=servo2ClosedPosition; SendDelay=ignitionSendDelay; }
    //RETURN BUTTON
    if ((digitalRead(BUTTON1)==1)||(serialState==1)) { state=1; S1=servo1ClosedPosition; S2=servo2ClosedPosition; SendDelay=pollingSendDelay; }
      
    break;


  case (4): //Ignition

    ignition();
    //HOTFIRE BUTTON
      if ((digitalRead(BUTTON4)==1)||(serialState==4)) state=5; 
      //RETURN BUTTON
      if ((digitalRead(BUTTON1)==1)||(serialState==1)) { state=1; S1=servo1ClosedPosition; S2=servo2ClosedPosition; SendDelay=pollingSendDelay; }
      
    break;
  case (5): //Hotfire stage 1

    hotfire();

    if (actualState==0) state=0;

Data acquisition and processing

Automation in calibration

COM Board
ellie-ground/COMBoard.ino at main · calstar/ellie-groundGitHub
Logo
Drawing of the state machine that determined the sequence in which events happened.