A last minute wheel discovery!

Last-minute change on the drive board.  I discovered that Hero IO ports 122 and 125 are Steering limit counter-clockwise and clockwise, respectively.  The problem is, I may not have enough ports on my Arduino to turn these into inputs.  I have the following ports left available on my Arduino Uno that I’m testing this with. – 0, 1, 2, and A3.

0 and 1 are reserved for serial RX and TX – this is an option but means I have to take precautions when uploading new code – namely, I would need to ensure everything is disconnected from these ports.  Additionally, it eliminates the ability to debug the chip in the future using Serial output. While I think I can work with these restrictions – neither are ideal.

2 Doesn’t actually exist on the Trinket Pro

A3 – this port is a very good option – too bad I don’t have 2 of them 🙁

My first thought is that perhaps, as A3 is an analog input, I can somehow use it for both C.C.W. and C.W. by using 3 flag voltages.
Maybe something like:

  • 5V  neither switch activated.
  • 2.5V C.W switch activated
  • 0V C.C.W. switch activated
With this as my plan, it’s time to break out the breadboard and see what I can do.
 After a little trial and error, I created the following circuit that does exactly that:

When S1 and S2 are open, R1 acts as a pull-up transistor to A3, bringing A3 to ~5V.  When S1 is closed, the path of least resistance for A3 is to ground, and A3 goes to ~0.  When S2 is closed, R1 and R2 act as a voltage divider, and the voltage goes to ~2.5V.

Testing of the circuit proved it worked as desired:

Leave a Reply

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