One of the requirements for my irrigation controller project is to have an accurate system clock – irrigation programs need to run at the correct time. This is where the absence of a Chardware RTC on the Raspberry Pi becomes apparent. – It isn’t a good idea to always assume that I will have network connectivity and access to NTP servers on bootup. As a result, part of my project build includes a DS3231 RTC on the I2C bus of the Raspberry Pi Zero which is the brains of the controller. The RTC module that I bought is available in packs of 3 for under $5 on dx.com.
While I was looking online for solenoid valves for my irrigation system, I discovered flow sensors… so I got myself one, like this one:
The idea is that the flow sensor allows me to measure how much water is being used out of my rainwater tanks (and going onto the garden).
I still remember the introduction of a friend’s electronics textbook at university. At least, remember one sentence: “Experience gained is directly proportional to the cost of equipment destroyed”. Going by that theory, I must have gained a lot of experience in Chemistry I, as I broke every piece of my glassware except my Liebig condenser!
This theory led me to deciding I needed to build an over-voltage protection circuit:
A couple of days ago the switches I plan to use to activate my on-off switch arrived. I had expected them to be DPST switches, but they turned out to be SPST switches. This required some redesign of my on-off switch to accommodate the fact that I only have one switch. To do this, I am feeding the output of the switch into a pair of Schmitt trigger inverters (in series to act as a buffer) as well as into a NPN transistor. The output of the buffer is then fed to my GPIO input, after first being adjusted to a 3.3V level using a zener diode. The reason for using two Schmitt trigger inverters is so that my output is active-high, meaning that the output only exceeds the zener voltage of the diode for a short period – meaning that my power loss on the voltage adjustment is realistically negligible because the output is so seldom high.
My first version of an on-off switch for the Raspberry Pi showed some issues, and needed some improvement.
Here is a quick schematic of the improved version:
One of the challenges with using a Raspberry Pi as part of a gadget or appliance is having an on/off switch. What I have tried to achieve here is to have a switch mechanism that allows me to use a dual momentary switch to turn the Pi on or off. When turning it off, the Pi needs to first shut down before power is disconnected. The latest arrival from The Pi Hut is now part of a prototyping exercise:
So somewhere along the line I started using iTunes to plat music, and also started using Apple’s Airplay to stream music to Airport Express base stations.
My oldest Airport Express has had a long hard life. It’s power supply failed about 5 years ago. I gave it a new lease of life by rigging a new power supply. Now at nearly 11 years of age, it is starting to give up the ghost. So, I decided to replace it with an open solution, using a Raspberry Pi Zero, PHAT-DAC audio board, and shairport airplay receiving software.
One of the challenges I have been trying to work out is how to use the alarm of a real-time clock to boot a Raspberry Pi once it has been shut down. I have been using DS3231 RTCs, which integrate easily with Raspberry Pi via I2C. The DS3231 also has a pin (INT/SQW), one of whose functions is to indicate that an alarm has activated.
Recent Raspberry Pis (A+ and B+ models and the Zero) have a reset jumper. If you short the two pins of the jumper (one of the pins is ground) it will reset the Pi if it is running, or if it was previously shit down, it will restart when the jumper is shorted. Now, if you can link the output of the alarm on a RTC to the reset jumper on a Pi, it becomes possible to set an alarm on the RTC and then shut the Pi down so that it can boot up again when the alarm on the RTC is activated….. Continue reading »
After a bit of prompting from a colleague, I decided to start keeping some records of the prototyping and fiddling that I have started with the Raspberry Pi Zero which I acquired recently. The Pi Zero is the smallest variant of the Raspberry Pi, and is still in rather short supply at the moment. To give an idea of size, this is what it looks like next to a TWSBI Diamond 580 fountain pen: