Adding backlight control to Waveshare 7″ touchscreen

I can’t say enough good things about OctoPrint. I can control either of my printers from any computer in my house, starting prints, aborting prints, uploading gcode or slicing, visualizing and the logo is quite endearing as well. With the addition of plugins, the web UI took a leap forward when BillyBlaze wrote TouchUI which adds a simpler finger-friendly interface that works well on tablets and phones. Being able to abort a print and restart it from an old Nexus 7 2012 tablet without having to fire up a computer really saved me a lot of trips back and forth. The Nexus tablet does an OK job, but it always chugs for a while when first woken up– something that doesn’t help when you’re quickly trying to stop a print that is in catastrophic failure mode. Recently a 7″ LCD panel came into my possession for use doing development to replace an old 24″ display that was taking far too much space on my desk just to be a temporary head of an embedded Linux system and I hooked it up to a Raspberry Pi to try it out running the TouchUI locally against OctoPrint.


Alarm Monitor from MQTT, not ADT

When I bought my house it came equipped with one of those olde fashioned house alarm systems where the central panel is wired into the phone landline. I never could quite wrap my head around why an alarm monitoring service, which is essentially just a reverse-telemarketing business, costs so much money to run. They’re paying people next to nothing to make a short phone call but charging customers $50 a month for it. I don’t even have a hard-wired phone so that’s another $25/month on top of that. I had the system so why not modernize it a bit?

The alarm zone circuitry is pretty simple, a wire runs to the sensor which is normally closed and opens when the sensor is triggered. To guard against an intruder simply shorting the wires, an “End of Line” resistor is installed in the panel at the end of every zone’s wire. This gives the alarm system 3 potential voltages

  • 0V – Shorted, Alarm
  • 12V – Open circuit (sensor is activated), Alarm
  • ~5V – Normal

I just needed a way to monitor the zone wire voltages and publish them into my MQTT network. I first considered resistor dividers to drop the voltages down to 0V-3.3V range and then using an ATmega’s ADC to measure them, but I was concerned the extra resistors might change the functionality of the alarm circuit. I just needed to compare the voltage to some reference voltages and give me a simple digital 0 or 1 depending on the alarm voltage.


Go to Top