hard to tell. One looked like maybe it did. Maybe it just broke as they don't seem robust enough for disassembly and there isn't a lot of igniter stuff on the tip. I am fairly certain I didn't let the leads touch each other, either.
Here's the link to the switch, although there isn't much more to be learned I think other than what I pasted from the spec details. Maybe youse guys see something I don't though .
amazon.ca/Remote-Controlled-Electronic-Switch-Relay/dp/B08FLVGTXQ
@LarryD
if you would, could you please elaborate on what you're driving at. I suspect that as it gets hot and before the ignition linkage burns off, the hot resistance would be less and that could be a problem? FWIW, I did test the voltage on the output before and after the launch attempt and it tested at the voltage I expected.
If i was unclear, I did not put a resistor in series. The box thingies that model rocketeers use are unfamiliar to me. What I have with an RC switch where the output voltage matches the input voltage is really just a switch in the form of a MOSFET. I have no idea if there's anything else in those rocket battery boxes than just a battery tray and a mechanical switch.
@alto777 c'mon, man.
It's literally those batteries on the input side of the RC switch, + and - voltage (tested) on the output side that matches the input, and a typical Futaba "J" connector controlling whether current flows between the input and output based on the pulse width.
The voltage going into the RC receiver is higher than the voltage on the switch side, but I don't see why that would matter.
The rocket circuit is isolated from the rest of the airboat, but everything grounds together through the receiver. I tested all the voltages to be exactly as expected, within spec.
@alto777 here you go, bro, tear my code to shreds again
(just kidding, I always appreciate your improvements on code I write). Code tests exactly as I expect.
#include <ESP32Servo.h>
// 5 pins IN from RC Rx: Throttle; Elevator; Aileron; Rudder; Aux1
// Recommended pins include 2,4,12-19,21-23,25-27,32-33
// first number listed in comments is where it was no Nano Every
static const int throttleSignalPin = 21; // throttle channel to pin d7/gpio 21
static const int aileronSignalPin = 22; // aileron channel to pin d9/gpio 22
static const int elevatorSignalPin = 23; // elevator channel to pin A2/gpio 23
static const int rudderSignalPin = 25; //rudder channel to gpio 25
static const int aux1SignalPin = 26; // Aux1 channel to gpio 26
//static const int aux1SignalPin = 6; // Aux1 channel to pin d6
//static const int rudderSignalPin = 17; // rudder channel to pin A3(alias 17 on Uno)
// 6 pins OUT to ESCs and RC (rocket) switches (if Nano Every/ if ESP32)
Servo starboardRocketSignalOut; // pin 5/15
Servo portRocketSignalOut; // pin 6/14
Servo starboardSignalOut; // pin 8/16 - drives all starboard side motors
Servo portSignalOut; // pin 10/17 - drives all portside motors
Servo sternSignalOut; // pin 11/19 - use elevator raw sig
Servo bowSignalOut; // pin 12/18 - N/C
// Recommended pins include 2,4,12-19,21-23,25-27,32-33
static const int portRocketSignalOutPin = 32;
static const int starboardRocketSignalOutPin = 33;
static const int starboardSignalOutPin = 16;
static const int portSignalOutPin = 17;
static const int bowSignalOutPin = 18;
static const int sternSignalOutPin = 19;
// general timer interval
const long interval = 1000;
// rocket countdown timing variables
int timer = 3; // 3 seconds to ignition after switch flipped - Adios, Joes!
unsigned long previousLaunchTimer;
// heartbeat LED
const int heartbeatLED = 2;
unsigned long heartbeatTime;
const unsigned long rocketOnInterval = 200; // blink interval for rockets on
const unsigned long rocketOffInterval = 600;
ESP32PWM pwm;
uint32_t spektrumTimeout = 22000;
// to store values for raw radio signals
uint32_t bowThrottleVal, sternThrottleVal, steerStarboardTrim, steerPortsideTrim, turnPortVal, turnStarVal = 0;
// to store modified values to go out to the ESCs
uint32_t bowValOut, sternValOut, steerPortOut, steerStarboardOut = 0;
// to read in Aux1 (flaps) channel
uint32_t rocketVal, rocketValOut = 0;
uint32_t rocketValMin = 400; // from RC switch datasheet
uint32_t rocketValMax = 2600; // from RC switch datasheet
int shouldFire = 0;
int ledFire = 0;
void setup() { // Allow allocation of all timers
ESP32PWM::allocateTimer(0);
ESP32PWM::allocateTimer(1);
ESP32PWM::allocateTimer(2);
ESP32PWM::allocateTimer(3);
Serial.begin(115200);
starboardSignalOut.setPeriodHertz(50);
portSignalOut.setPeriodHertz(50);
sternSignalOut.setPeriodHertz(50);
bowSignalOut.setPeriodHertz(50);
pinMode(throttleSignalPin, INPUT);
pinMode(elevatorSignalPin, INPUT);
pinMode(rudderSignalPin, INPUT);
pinMode(aileronSignalPin, INPUT);
pinMode(aux1SignalPin, INPUT);
pinMode(heartbeatLED, OUTPUT);
attachMotors(); // just the propulsion ESCs
portSignalOut.writeMicroseconds(900);
starboardSignalOut.writeMicroseconds(900);
sternSignalOut.writeMicroseconds(900);
bowSignalOut.writeMicroseconds(900);
Serial.println("\nwaterMoccasinFiveMotor\n");
previousLaunchTimer = 0;
}
void loop() {
readPWMValues();
updateMotorValues();
setMotors();
// printRealTimeMotorData();
printRealTimeRocketData();
switch (ledFire) {
case 0:
if (millis() - heartbeatTime >= rocketOffInterval) {
heartbeatTime = millis();
digitalWrite(heartbeatLED, !digitalRead(heartbeatLED));
}
break;
case 1:
if (millis() - heartbeatTime >= rocketOnInterval) {
heartbeatTime = millis();
digitalWrite(heartbeatLED, !digitalRead(heartbeatLED));
}
break;
default:
break;
}
}
void readPWMValues() {
bowThrottleVal = pulseIn(elevatorSignalPin, HIGH, spektrumTimeout); // motors toward the bow
sternThrottleVal = pulseIn(throttleSignalPin, HIGH, spektrumTimeout); // the one mid stern motors, signal attached to throttle cut
steerStarboardTrim = pulseIn(rudderSignalPin, HIGH, spektrumTimeout); // not wired to anything, these are trim values as a feature of the transmitter settings
steerPortsideTrim = pulseIn(aileronSignalPin, HIGH, spektrumTimeout); // not wired to anything, these are trim values as a feature of the transmitter settings
rocketVal = pulseIn(aux1SignalPin, HIGH, spektrumTimeout);
}
void printPWMValues() {
Serial.print("bowThrottleVal: ");
Serial.print(bowThrottleVal);
// stern motors
Serial.print("\tsternThrottleVal: ");
Serial.print(sternThrottleVal);
// steering offsets
Serial.print("\tsteerStarboardTrim: ");
Serial.print(steerStarboardTrim);
Serial.print("\tsteerPortsideTrim: ");
Serial.println(steerPortsideTrim);
}
void updateMotorValues() {
/*
Use Throttle signal in for two main motors up to its max
Use Elevator signal for other two aux motors up to THR max
Then use difference between Elev max and Thr max to drive top speed all motors
Ail and Rud should init about 1200 or so. (1283)
pushing right stick LEFT increases Ail val up to about 1800 while decreasing Rud val to stall
pushing right stick RIGHT increases Rud val up to about 1800 while decreasing Ail val to stall
bowValOut, sternValOut, steerPortOut, steerStarboardOut = 0;
Servo starboardSignalOut; // pin 16 - drives all starboard side motors
Servo portSignalOut; // pin 17 - drives all portside motors
Servo sternSignalOut; // pin 19 - use throttle raw sig, just one rear mid motor
Servo bowSignalOut; // pin 18 - N/C
*/
// handle the motors
sternValOut = sternThrottleVal; // just stern large prop mid motor
// port and star pairs, untrimmed to give max range
if (steerStarboardTrim > 1300 && steerPortsideTrim < 1260) {
steerStarboardOut = steerStarboardTrim * 0.90;
steerPortOut = steerPortsideTrim * 0.90;
} else if (steerPortsideTrim > 1300 && steerStarboardTrim < 1260) {
steerStarboardOut = steerStarboardTrim * 0.90;
steerPortOut = steerPortsideTrim * 0.90;
}
else {
steerStarboardOut = sternValOut;
steerPortOut = sternValOut;
bowValOut = sternThrottleVal;
}
// handle the rockets
switch (rocketVal) {
case 900 ... 1699:
shouldFire = 0;
ledFire = 0;
break;
case 1700 ... 2000:
shouldFire = 1;
ledFire = 1;
break;
default:
shouldFire = 0;
ledFire = 0;
break;
}
switch (shouldFire) {
case 0:
rocketValOut = rocketValMin;
coolRockets();
break;
case 1:
{
starboardRocketSignalOut.attach(starboardRocketSignalOutPin);
portRocketSignalOut.attach(portRocketSignalOutPin);
// set countdown timer
unsigned long thisLaunchTimer = millis();
if (thisLaunchTimer - previousLaunchTimer >= interval) {
previousLaunchTimer = thisLaunchTimer;
timer--;
if (timer == 0) {
fireRockets();
}
if (timer == -1) {
timer = 3;
}
}
}
break;
default:
rocketValOut = rocketValMin;
coolRockets();
break;
}
}
void setMotors() {
bowSignalOut.writeMicroseconds(bowValOut);
sternSignalOut.writeMicroseconds(sternValOut);
starboardSignalOut.writeMicroseconds(steerStarboardOut);
portSignalOut.writeMicroseconds(steerPortOut);
}
void coolRockets() {
starboardRocketSignalOut.detach();
portRocketSignalOut.detach();
}
void fireRockets() {
rocketValOut = rocketValMax;
starboardRocketSignalOut.writeMicroseconds(rocketValOut);
portRocketSignalOut.writeMicroseconds(rocketValOut);
}
void printRealTimeMotorData() {
// bow motors
Serial.print("bowValOut: ");
Serial.print(bowValOut);
// stern motors
Serial.print("\tsternValOut: ");
Serial.print(sternValOut);
// steering offsets
Serial.print("\tsteerStarboardOut: ");
Serial.print(steerStarboardOut);
Serial.print("\tsteerPortOut: ");
Serial.println(steerPortOut);
}
void printRealTimeRocketData() {
if (shouldFire == 0) {
Serial.print(F("\n\trocketVal: "));
Serial.print(rocketVal);
Serial.print(F("\trocketValOut: "));
Serial.print(rocketValOut);
Serial.println(F("\t\tRockets Cool\n"));
} else if (shouldFire == 1) {
Serial.print(F("\n\trocketVal: "));
Serial.print(rocketVal);
Serial.print(F("\trocketValOut: "));
Serial.print(rocketValOut);
Serial.println(F("\t\tRockets Ignite!\n"));
}
}
void attachMotors() {
starboardSignalOut.attach(starboardSignalOutPin);
bowSignalOut.attach(sternSignalOutPin);
portSignalOut.attach(portSignalOutPin);
sternSignalOut.attach(bowSignalOutPin);
}
void detachMotors() {
starboardSignalOut.detach();
portSignalOut.detach();
bowSignalOut.detach();
sternSignalOut.detach();
}
Everything connected like these pics.
In summary, kindly recall that I was mostly looking to see if my Ohm's Law math was sound. I sincerely appreciate all of you taking the time; however, every part of this project tested perfectly as expected in action, by Serial and by DMM.
I still wonder though what @LarryD meant, "cold resistance". Is that where I screwed up?