diff --git a/README.md b/README.md index 6b29446..e2b54ab 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,7 @@ NOTE: SPEKTRUM SATELLITE RECEIVERS ARE 3.3V DEVICES! Application of more than 3. The following schematic details the circuit used for this binding process. The GPIO pins in the diagram do not match the pin assignments in the code! ![BindCircuit](https://user-images.githubusercontent.com/104041016/182746055-f7c7d6db-a366-4edc-8f20-23109ccb1560.png) + +Alternative circuit setup, with no BEC, using onboard 3.3V line from the Raspberry Pi Pico and a simple switch. Pinout can be seen in the photo, only hidden component is a 1.2K pulldown resistor on pin 9 the other side of the PCB. + +![PhotoCircuit](images/PhotoCircuit.jpg) \ No newline at end of file diff --git a/SpektrumBind.ino b/SpektrumBind.ino index c724db8..277f5df 100644 --- a/SpektrumBind.ino +++ b/SpektrumBind.ino @@ -12,7 +12,7 @@ //Pin Assignments static const uint8_t receiverVcc = 0; -static const uint8_t switchSignal = 15; +static const uint8_t switchSignal = 9; static const uint8_t receiverSignal = 10; static const uint8_t numBindPulses = 9; //Use Universal @@ -20,6 +20,8 @@ static const uint8_t numBindPulses = 9; //Use Universal void setup() { // put your setup code here, to run once: + pinMode(LED_BUILTIN, OUTPUT); + pinMode(switchSignal, INPUT); //Switch imput to read when reciever is powered on. Use External 10K Pulldown Resistor pinMode(receiverVcc, OUTPUT); //Reciever Power @@ -30,26 +32,36 @@ void setup() { digitalWrite(receiverVcc, HIGH); //Power On digitalWrite(receiverSignal, HIGH); //Allows for falling pulses - delay(5000); + delay(500); } void loop() { + digitalWrite(receiverSignal, LOW); + digitalWrite(LED_BUILTIN, HIGH); // Use a physical switch to power on reciever and begin pulses immediately + while(!digitalRead(switchSignal)){ + delay(10); + } + Serial.println("High"); + digitalWrite(receiverSignal, HIGH); + digitalWrite(LED_BUILTIN, LOW); + delay(100); //Ensure reciever powered on before delivering pulses + + for(uint8_t pulseCount = 0; pulseCount < numBindPulses; pulseCount++){ //Deliver Falling Pulses + digitalWrite(receiverSignal, LOW); + delayMicroseconds(120); + digitalWrite(receiverSignal, HIGH); + delayMicroseconds(120); + } - if (digitalRead(switchSignal)){ - Serial.println("High"); - delay(100); //Ensure reciever powered on before delivering pulses - - for(uint8_t pulseCount = 0; pulseCount < numBindPulses; pulseCount++){ //Deliver Falling Pulses - digitalWrite(receiverSignal, LOW); - delayMicroseconds(120); - digitalWrite(receiverSignal, HIGH); - delayMicroseconds(120); - } - - Serial.println("Pulses Sent"); - delay(15000); //Power on transmitter in bind mode within this delay period + Serial.println("Pulses Sent"); + while(digitalRead(switchSignal)){ + //Power on transmitter in bind mode within this delay period + digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) + delay(500); + digitalWrite(LED_BUILTIN, LOW); + delay(500); } } diff --git a/BindCircuit.png b/images/BindCircuit.png similarity index 100% rename from BindCircuit.png rename to images/BindCircuit.png diff --git a/images/PhotoCircuit.jpg b/images/PhotoCircuit.jpg new file mode 100644 index 0000000..1c7abcd Binary files /dev/null and b/images/PhotoCircuit.jpg differ