This post is long overdue. Recently, had a chance to present what I did with Raspberry Pi some years back. Powerbot is a fun experiment publishing the status of electricity availability in my home town back when we faced an electricity crisis.
Back in 2012, we were facing serious load shedding.
Trying to figure out the time and duration of the load shedding.
Heard about Raspberry Pi and was looking for an actual use case to buy it.
That is when I imagined using Raspberry Pi to automatically collect electricity availability and publish it to the world via Twitter!
"Imagination is more important than knowledge." - Albert Einstein.
GPIO - General Purpose Input Output pins. We can read/write state. State can be either 1 or 0, purely binary based on the voltage level.
This is a simple circuit that changes the state of the GPIO_IN_4 using LDR. LDR - Light Dependent Resistor.
LED light powered using mains line is placed in front of the LDR.
3 wires are connected to Pi.
2 for powering the circuit and one for detecting the state.
Built using Python. Simple Program would check the status of the electricity every second.
If there is a change in status, it will trigger generating twitter message.
Message will be buffered in local as well just in case internet connection goes down.
I had used Twython client library to connect with Twitter. Even built a wrapper around this to overcome the unstable Internet connection.
Following code is used to set up and detect the status.
Let's revisit what happened on the Feb 26, 2013.
Daily Report:Feb 26, 2013. OFF TIME: 4:36:31. Availability: 80.80%. Change: +5.03%.
Apparently, latest tweets in the account has some issues probably due to hardware malfunctions.
Doing electrical wiring, taking out the electrical wiring out of the switch box.
Identifying the electronic components and soldering it to the board.
Writing the software to read the GPIO pins.
Tweet it out to the whole world the status of electricity in my hometown.
It would have been real fun if powerbot tweeted the ON/OFF time before it happened.
I did powerbot, before the IoT became famous. It happened in early 2013. Loooooong time back.