The U.RAT Kill Switch and LCD Display

Spinning a capacitor is no problem – you can spin it as much as you’d like in either direction. But the roller inductor would not last if a high torque stepper motor keeps banging on its stops. My first idea (following the KISS rule) would be to just add some leds – green for L – and turn it on when the rocker switch is to the left, yellow when its to the right, and turn a blue led on when a micro switch detects that you are near the end. The code to detect a micro switch is trivial and would fit snugly in the u.RAT C code:

if (digitalRead(buttonPin) == HIGH) {         
      digitalWrite(stepPin, LOW);
} else {
  digitalWrite(stepPin, HIGH);
  digitalWrite(stepPin, LOW);

The problem is that you are now “tuning in the dark” and don’t have a repeatable process – like you would if you had dial markings. Instead, you could have a simple LCD display instead of the LEDS:

Adafruit Pi OLED. Notice how it uses I2C pins and no GPIO pins. This is very important!

In fact, since I am more inclined to dedicating my Raspberry Pi Zero W to this project, this small “Pi-O-LCD” display is perfect for the task. The WiringPi library that I am already using has an LCD Library, and it is as easy as setting up the device (mapping it) and then just writing to it. I would just have a counter that adds the number of ticks going up (CW) and subtracts them if going down (CCW). In fact, that library even has what looks like a normal printf function – but for the LCD!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: