0
$\begingroup$

I have a 16 Channel Servo Driver board from Adafruit (see here), and I communicate to it via I2C using a Raspberry Pi. The servo board is controlling a Qbrain by sending a PWM pulse between 1ms to 2ms and it works great.

Problem is, I'm trying to create a kill switch such that the signal from the servo board would cease, and the ESC would stop because it detects no PWM signal. I have placed a toggle switch that cuts the VCC to the servo board, so technically it should no longer produce any PWM signal, however when the power is cut, the ESC jumps to 100% throttle, I can only assume this is because the ESC believes the signal is 100% duty cycle, but how do I solve this?

$\endgroup$
0
$\begingroup$

The problem you have is that you're not sending any PWM signal, so the ESC is behaving erratically. You could try to do code to correct for this, but you could have any number of issues.

What I do any time I need to implement a kill switch like this is to use a power relay. You can drive the relay coil from the microcontroller with a transistor as depicted in my crude schematic below.

In this circuit, you have a power switch to turn on the microcontroller board, but then you have to also send HIGH to whatever pin you assign "ESC Enable" in order to close the contacts in the load relay.

Now, with this setup, you can setup a heartbeat. The transmitter sends a packet that sets a heartbeat bit HIGH in the receiver. The receiver uses an interrupt to poll the heartbeat bit and, if it's HIGH, clears the bit. If it is LOW, then you have the option to either kill power on the spot (set ESC Enable to LOW) or you could wait for N heartbeats to be LOW.

As a final note, be sure that you enable, add, configure, etc. a pulldown resistor to the ESC Enable pin to ensure that the pin is LOW any time it would otherwise be floating.

Load Enable Schematic

$\endgroup$
  • $\begingroup$ "You could try to do code to correct for this", yea, the point of having the kill switch was to have manual override in the case that the raspberry pi dies and the PCA9685 still transmits a PWM signal. Thanks for your input though, I'll try and implement a power relay. $\endgroup$ – chutsu Jul 31 '15 at 18:38
  • $\begingroup$ What do you mean "the raspberry pi dies"? If you mean the controller powers off, if you use a pulldown resistor on the ESC Enable line the pin should go low, disabling the relay and thus the load. If you mean the controller loses communication with the remote (you, the operator), then the heartbeat count will timeout and the logic should drive ESC Enable low, again disabling the load. The way you've worded your comment makes it seem like you have some issue with this solution, but I'm not sure what the problem is. $\endgroup$ – Chuck Jul 31 '15 at 18:42
  • $\begingroup$ The problem is the Servo Driver board is powered by a PCA9685 chip, the chip does not require a i2c heart beat like signal from the Raspberry Pi to continually transmit a PWM to the ESC. So in the scenario when the Pi hangs or halts (my only remote communication to the Quadcopter), the PCA9685 chip will still continue to transmit PWM signals regardless, the only way I can think of to kill it is to stop supplying power, or have an auxiliary comms to send a stop signal. $\endgroup$ – chutsu Jul 31 '15 at 20:50
  • $\begingroup$ The way I have the circuit setup is I have no RC receiver, I only have a Pi, the Servo Control board (PCA9685), an ESC and IMU. $\endgroup$ – chutsu Jul 31 '15 at 20:52
  • $\begingroup$ The reason why I know it will continually send PWM is because on the product website it states "It's an i2c-controlled PWM driver with a built in clock. That means that, unlike the TLC5940 family, you do not need to continuously send it signal tying up your microcontroller, its completely free running!" (source: here) $\endgroup$ – chutsu Jul 31 '15 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.