My bunnyuncle
PyCon Pune devs sprint hardware room
time 10 AM
The room was full with engineering students, professional engineers, hardware guys. And among them there was me, a lawyer and I do not understand a single bit of hardware.
I was cursing myself why am I here. In fact I have considered all the black cables, most of the hardware as UFO (Unknown Foul Object) creating mess in my house, courtesy: husband dear. And now I have to work on those.
I Want to ran away.
Wish I had a Tardis.
"Doctor..."
Unknown Foul Object == Known Cute Object
The first few good thing that made me comfortable were:
The object which we were suppose to work on was a bunny. Its cute. Its cool. I love it. Let me introduce you to bunny. It is a small bunny shaped board designed by Dr. Terri Oda and John Hawley. It has a ESP82866 on board. It is an open source project and the whole thing available in github
We had John as our mentor. A friend who gave me the freedom that I can interrupt him at any point which I do not understand. From scheduler to ARM, from scheduler to hardware licensing he explained to me all and most importantly the way a novice like me will understand. Thank you John, for making me fall into love with hardware.
The hesitant me started working. Initially what we were trying to code on micropython to lit LEDs up. We have actually made the circuit on breadboard. Initially one there, after multiple LEDs to it.
Working with bunny
After lunch I started working actually on bunny. John explained me different parts of it. Initially I tried to control the "magic button". Then I lit up the bunny's ears. Then playing with the LEDs. Lighting it in different random order and intensity.
Though the dev sprint is over but the fun is not I gave back home and took another step forward with the bunny. I named my project bunnyuncle.
The bunnyuncle
My idea was that the LEDs, specifically in the right ear of the bunny will lit up every time someone mentions me in the twitter. The schematic of py project looks like this:
With an object to give the project a shape I have divide the project into three parts:
I have written a server.py by and through which I am fetching data, i.e the notifications (which mentions me as @anweshasrkr) from twitter to my server. I am using the Python tweepy module for getting notifications from twitter. I am keeping the authentication data in conf.toml.
For every notification I am publishing a message to Mosquitto. Mosquitto is message broker which uses MQTT Protocol. MQTT is a lightweight protocol for small sensors and mobile devices. Mosquitto can be installed in Fedora by using the dnf command.
The bunny is subscribed to the same topic in the Mosquitto. Therefore every time a message published to the Mosquitto in the specified topic, the bunny is receiving the message, and lighting up the right ear. The project is available in the github. main.py contains the code that runs in ESP8266.
This is my second attempt to code in Micropython, [first time it was with Microbit]( (GHOST_URL/a-date-with-microbit-february-meetup-of-pyladies-pune/). Coding in hardware using micropython is fun. Try it yourself.
Wish I could go back to that time, in that hardware room.
Wish I had a Tardis.
"Doctor..."