I needed a simple LUA module (with callbacks) that I can use to drive the cheap 28BYJ-48 & ULN2003 Combo for automating a Candy Jar. I did search online around to see if there is a readymade one available. when I couldn’t find any exact matches, Just wrote a Lua module based on bits and pieces I found online. Hope you find it useful. Feel free create an issue in Github project or get in touch with me for any feature requests.
Hello, My dear fellow Raspberry Pi fan! hope your Pi-iot-hacking is going well.
Here is one from my side, read on…
I run so many things on my poor little raspberry pies and they often get heated up with all the burden I put on them. Since they are running headless, I don’t really know if it is on the verge of getting fried till it is too late. so after a couple of overheating instances, I started thinking, … How do I solve this issue?
As a first step, I came up with this simple hack which is a short nodejs script to monitor raspberry pi CPU temperature remotely.
This runs as an autostarting Linux(Raspbian) service on raspberry pi which measures CPU temperature and posts to a configured MQTT broker topic Note: you can configure your broker and topic in app.properties
I use mqtt-spy to monitor and generate the graphs. feel free to get in touch with me if you are having any issues with using this by opening an issue.
Here is a screenshot of my Pi temperature increasing because of the dd command I used to stress the CPU [ awesome plots you see here are the courtesy of mqtt-spy ].
For detailed instructions on how to install the project, you can head to the git repo.
But it is not enough to know that it is heating up. We need to act on it, so for that part, I am planning to attach a fan to the raspberry pi and run it when the temperature goes beyond a particular threshold. Apart from the temperature, I believe knowing which process is loading the CPU is might help so I am thinking it might be a good idea to add the top 3 processes by CPU usage to the MQTT message. which might look something like this …
Since there are not enough structured courses on IoT in universities which really focus on the practical aspects of it, after blogs, Youtube became my defacto learning source for IoT. which is almost as good as quality college education without the pain of rules and rigidity of academic institutions.
Below are some of the youtube channels I currently follow. you might want to check them out. Being a computer science masters grad, I had a lot of trouble with electronics basics and these channels are a key part of filling the gaps in my knowledge and accelerating my learning process. Please note that this is no way an exhaustive list but these are just my favorites.
Like most of the IoT enthusiasts, I also got excited when I first came across esp8266 from the espressif chip maker. Like any good student, I started with the nodemcu dev boards instead of trying to DIY-ing development boards. These dev boards were simply magical when compared to AT89s52 [8051 family] or Arduino that I used in past. Don’t even get the wrong impression that I don’t love Arduino but the fact that turnaround time for trying out things got greatly reduced with nodemcu made me get addicted to this platform.
Nodemcu dev boards v0.9(left) v1.0 (right)
This huge gain in productivity is partially due to the crisp documentation of the platform and modules available and also due to the fact that coding in Lua language is pure fun compared to C. One of the main reasons for that is the asynchronous event-driven programming model needed for Lua nodemcu whereas good old C language puts me in procedural auto-pilot mode which IMO, is not at all suitable for embedded system development. You can take my word when I say “it becomes very easy to learn async model in nodemcu Lua if one got used to similar event-driven async programming paradigm in past in any other language” ( like nodejs or any desktop or web UI programming Ex: Java AWT or something so common as js ajax).
Believe it or not, it simply brought tears of joy to write an internet-controlled-led program and get it working in a few minutes compared to blinking a led in 8051 which took a few days the first time [When I started learning 8051].
For example, this is how much code it takes to run a “Hello, World!” HTTP server on the wifi microcontroller!
But now comes the moment of truth,… you cannot go beyond blinking LEDs and few other fancy tricks with dev boards due to their size, cost and power requirements. which triggered my quest to find a suitable replacement minimal microcontroller circuit for prototypes. something that has below qualities
small enough to fit on a PCB or prototype board without adding too much thickness
cheap enough to leave in a project
easy enough to write code for [I used nodemcu]
esp8266 has several variations based on the size and shape esp01 to esp12, 13, 32… the list goes on. I tried esp01 as it looked like a standalone dev board but
it was too sensitive to any interference and would reset very frequently.
not breadboard friendly
The infamous esp01 [$2 wifi mcu] from espressif that rocked IoT maker world
Lovely ray of the sunshine:
Finally, then I found the lovely ray of the sunshine in a dark realm of hobby electronics ……… Bang! esp12 !!! which fits my previous list of requirements very nicely…
A hindering Problem:
but one thing I always found hard was soldering esp12 as its 2mm pin spacing is much less than that of a breadboard or prototype board (usually 2.54mm).
Here is how my initial attempts looked like…
Note: I am aware of my lousy soldering skills .. please don’t trouble yourself talking about it again 😛
The Solution that I stumbled upon:
Then came to my rescue the “ESP 07 and 12 Adapter plate” ….. TADA! available for 22 cents a piece ( which is RS 15 for me when I bought from India) in Ali express. It made life so much easier and happy when I did not have to solder esp on a prototype board and it felt just like when became old enough in childhood and realized that killer clowns from outer space most likely are not a real thing and I can stop worrying about 😀
Adapter plate front face
Adapter plate back face
Final Result: Esp12 soldered on the adapter plate
Want to give it a try?
Here is the product link if you want to give it a try…
on a second thought, have you done anything similar and found any better alternative ? can you please graciously share it in below comments to reduce future trial and error frustration time for me. 🙂
My future plans:
Next thing I want to try is to create a proper PCB with SMD components for situations where I get into space constraints and this adapter proves to be too space consuming.