Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano Controlled Rocket Thruster with Load Cell Feedback and SD Data Logging

View and Edit Project In Cirkit DesignerImage of Arduino Nano Controlled Rocket Thruster with Load Cell Feedback and SD Data Logging

Circuit Documentation

Summary

This circuit is designed to control a rocket thruster using an Arduino Nano as the central microcontroller. The circuit includes a solenoid for controlling the thruster, a load cell with an HX711 amplifier for measuring force, an SD module for data logging, and a pushbutton for user interaction. The circuit is powered by a 12V power supply, and it includes diodes for protection, MOSFETs for controlling high-current loads, and resistors for current limiting and pull-down purposes.

Component List

Solenoid

12V Power Supply

Arduino Nano

SD Module

SparkFun Load Cell Amplifier - HX711

Diode

Resistor (10k Ohms)

MOSFET

Pushbutton

Load Cell - Red/white/black/green

Wiring Details

Solenoid

12V Power Supply

Arduino Nano

SD Module

SparkFun Load Cell Amplifier - HX711

Diode

Resistor (10k Ohms)

MOSFET

Pushbutton

Load Cell - Red/white/black/green

Documented Code

/*
 * This Arduino Nano controls a rocket thruster.
 */

#include <SD.h>
#include <SPI.h>
#include "HX711.h"

// Pin definitions
const int LOADCELL_DOUT_PIN = 3;
const int LOADCELL_SCK_PIN = 2;
const int SD_CS_PIN = 10;
const int SOLENOID_PIN = 6;
const int EMATCH_PIN = 7;
const int BUTTON_PIN = 4;

// HX711 Load Cell Amplifier
HX711 loadcell;

// SD card file
File dataFile;

// Timing variables
unsigned long lastMillis = 0;
const unsigned long interval = 100; // Interval for reading and logging (100 ms)
const unsigned long match_wait = 500; 

bool started = false;

void setup() {
    // Initialize serial communication
    Serial.begin(9600);

    // Initialize the load cell
    loadcell.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

    // Initialize the SD card
    if (!SD.begin(SD_CS_PIN)) {
        Serial.println("SD card initialization failed!");
        return;
    }
    Serial.println("SD card initialized.");

    // Open the file for writing
    dataFile = SD.open("datalog.txt", FILE_WRITE);
    if (!dataFile) {
        Serial.println("Error opening datalog.txt");
        return;
    }
    dataFile.println("Time(ms),LoadCellReading");  // Adding headers for clarity

    // Initialize pins
    pinMode(SOLENOID_PIN, OUTPUT);
    pinMode(EMATCH_PIN, OUTPUT);
    pinMode(BUTTON_PIN, INPUT);
}

void loop() {
    if (digitalRead(BUTTON_PIN) == HIGH) {
        if (!started) {
            started = true;
            digitalWrite(EMATCH_PIN, HIGH);
            if (millis() - lastMillis >= match_wait) {
                digitalWrite(SOLENOID_PIN, HIGH);
            }
        } else {
            started = false;
            digitalWrite(SOLENOID_PIN, LOW);
            digitalWrite(EMATCH_PIN, LOW);
            exit();
        }
    }
    // Check if the interval has passed
    if (millis() - lastMillis >= interval) {
        lastMillis = millis(); // Update the lastMillis variable

        // Read the load cell data
        if (loadcell.is_ready()) {
            long reading = loadcell.read();

            // Log the data to the SD card
            dataFile.println(String(millis()) + "," + String(reading));
            dataFile.flush();
        } else {
            Serial.println("HX711 not found.");
        }
    }
}

void exit() {
    dataFile.close();
    Serial.println("Data logging finished.");
}

This code is responsible for controlling the rocket thruster sequence, reading data from the load cell, and logging the data to an SD card. The pushbutton starts the sequence, which first ignites the