ATtiny85 – RC switch

I have finally managed to program an ATtiny85 to act as a RC switch! The switch will work as a "poor-man's-ESC-reverse". I bought a cheap ESC for my Ballbot Project and it has no reverse mode, it is made for RC aeroplanes, so I have to implement a relay that acts as a "polarity-switch" to be able to make a reveres motion on the motors.

The ATtiny85 will read the position of the throttle stick, when the stick reaches about centre position the motor will stop, and the relay switch the polarity. Depending on if the throttle stick travels from centre to top or centre to bottom the motor will now be able to go into forward motion or revere motion. Without the RC switch the motor will go from forward to stop to forward again.


Looking at the receiver's PWM-signal with an oscilloscope

At first I thought I could get the PPM-signal from the receivers battery pin, but it turned out that it uses some sort of serial communication and not PPM. I decided to take a look at the PWM-signal coming directly from channel one instead. It has a timing between 920-2060 µs when moving the throttle stick, and setting the travel rate to +/-150% in my Spektrum DX7 transmitter.

When it came to programming the MCU I simply (not too simple at fist because I'm a noob 😉 ) made a tiny C-program with a pin change interrupt reading the PWM-signal from channel one (throttle stick). With this information I can determine if the stick travels from centre to top or centre to bottom by making some simple if- and else-statements.

See the source code from my Git repository HERE!

In the clip you can see the code in action, using two LEDs to indicate forward and reverse motion. I will later on make a PCB for the ATtiny85, a relay and a bi-LED for direction indication.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *