Lamp Status Indicator


I have added a lamp status indicator LED.
The one thing I did not like was that from the cab during the day, if you by chance turned on a light you did not know it was on. I found this out driving to work one day and luckily I was behind a truck where I could see the light in the reflection off of the truck. There is nothing more annoying (and probably illegal) as someone coming at you with a full set of lightbar lamps turned on.
For testing, I used a pi zero with headers. For the actual unit, I will not use one with headers but solder the wires directly to the GPIO sockets.
This will make for a very small unit, just barely bigger than the pi zero footprint.


Adding the LED was simple.
First I had to update the relay controller to return the status of each relay state.
To me the easiest way was to simply combine they all into a single string of zeros and ones.
All off would simply be "0000".
As each one was turned on, it would toggle that string index to 1, like 1000 or 0100.
Since I am not checking individual relays (which is possible if you wanted to add an LED for each lamp), all I need to do is check if any of the relays are on.
Logically then, from the controller side:
if relaystate == "0000"
turn LED off
anything else
turn LED on
Quite simple.
Just like I used in the "toggle relay state" example, by using the input state, I am able to return the status string by building each state.

Since toggling the relay is done by the relay number 1,2,3 or 4, I made the status call method to watch for zero.
I have updated the bluetooth relay control code and the bluetooth console code and it works as expected. "Anything on" now triggers the LED state to high.

Concept Drawing

This means the mini-min controller will only include the pi zero, 4 buttons, 1 resistor, 1 LED and the power cord.
I invision a wrap for the pi zero with just enough room for the USB (which will be mounted either as a cable or built into the mesh so that it plugs directly into a usb outlet, providing the support for the unit itself), the LED and four buttons. The buttons would either be on the side or on the top, keeping in mind that it will be activated by the driver in the vehicle.
I could also just leave the existing usb power open for direct plug in from a separate external cord.