Note that the “zero” in the title of the repository and in js-gpiozero does not refer to the Raspberry Pi Zero but to the original gpiozero Python library.
This should remove some of the guess work when attempting to use the relatively-new library since their documentation examples at the moment are taking a back seat to their code port from the more-extensive Python offering.
This approach can easily be modified to instead exercise external LEDs (as soldered or otherwise attached to the header pin locations seen below). Note that you’ll use “BCM numbering” for APIs such as this one. For external LEDs, you would need to connect it inline with a resistor from a selected pin to one of the grounds for this to work with correct orientation of the LED’s anode/cathode, of course.
// Existing code, for a Raspberry Pi Zero
var ledActivity = new LED(47, false);
// For Raspberry Pi 3, for example
var ledActivity = new LED(47);
And that’s it. Since the Raspberry Pi Zero assumes an opposite value for true/false than the bigger models, it’s necessary to configure this in the device constructor to make things work as expected. Since BCM pin 47 is the activity light on the board itself, this will allow you to control it.
My two packages arrived today at the post office so I just hauled in all the loot from this earlier post in which I’ve purchased some new toys.
Raspberry Pi Zero W
The photos from their website don’t really describe how truly small this computer is now. They’ve somehow managed to stack the RAM on top of the microprocessor to save space. As I’ve apparently ordered the wrong video adapter cable, I’ve got a trip over to Best Buy Frye’s Electronics this evening so that I can sort that one out. I need a female HDMI to DVI, in other words. Otherwise, I’m still pretty stoked. Since there’s only one micro-USB I think I’ll temporarily need a small USB hub while I’m at it.
This arrived as well, all four of the segments but it was lost on me that I’ll need to solder each of them together. Fortunately, I have a soldering iron here somewhere. :looks around: I’m certain of it.
COZIR CO2 Sensor with RH/Temp
And in the other relatively BIG package is the relatively small sensor package. No wonder they charged me $21.88 to ship this to me. Seriously, it weighs about an ounce.
And it looks like I’ll need a 2×5 jumper to attach this over to the Raspi, with a solder-able header for that, too.
Alright, I’m back from Frye’s with a handful of stuff and I’m back in business. The video adapter allows me to see what’s coming out of the Raspberry Pi Zero W and the micro-USB hub allows me to hook up a keyboard and mouse to talk to it locally. A first install with the Raspbian Jessie Lite image resulted in a terminal-only configuration (I must have been in a hurry and didn’t read the differences on their page) so a second install of Raspbian Jessie with Pixel was just what it wanted: a full desktop experience. If I get some time this weekend I’ll try to have it talk to either the sensor or the light ring.
I just managed to solder together the NeoPixel ring. Due to the size of the electrical pads on the ends of these, I’d suggest that this falls into the catagory of advanced soldering and not to be taken on by the average person.
Additionally, I’d say that this feels a bit fragile in the area of the soldering joints between each quarter-circle. I’m going to suggest that anyone who incorporates one of these into their project needs to seriously think about ways of making this more stable/reliable since the soldering joints between them are tenuously-small. (Imagine three distinct electrical connections across the tiny width of this thing.)
What I also found is that there isn’t anywhere to clamp a hemostat for soldering these jumpers since the LEDs run all the way to the end where the connections should go.
I did add an inline resistor as Adafruit suggested to lower the input voltage or perhaps to lower start-up voltage spikes.
I managed to re-purpose a nice external 5V switching power supply that should drive all the LEDs nicely. It was left over from the supercomputer project when I swapped in a USB-based charger instead for that. Amazingly, Adafruit suggests that those 60 LEDs need a whopping 3.6A of power to drive them. I’m guessing that reality is more like 1A but I’ll play this safe. Per Adafruit’s suggestion I included a 1000 µF electrolytic capacitor across the output voltage to protect the NeoPixels.
So I’m prepped to do a final test of the NeoPixel ring for power and functionality on a standard Raspberry Pi 3 rig (since it sports an actual header). Once I’ve coded a test and verified that it works then I’ll take the soldering iron to the Raspberry Pi Zero W and wire it in with a quick-connect.
I’ve now got the Raspberry Pi Zero W booting with just the power adapter. Note that you can rename its hostname, toggle on the VNC Server, adjust the default screen resolution to your liking and then—in the Finder program in OS X—open up a remote session to its Desktop with vnc://email@example.com, for example. Or, toggle on the SSH Server and connect from a Terminal session with ssh firstname.lastname@example.org.
Have I mentioned how awesome it is to have a fully-functioning computer for $10 (plus $6 for the micro SD)?
And now the power supply is completed and wired to the NeoPixel ring. Everything’s set for 5V DC in at the moment but I may try to adjust the input voltage down to 3.3V later for technical reasons. (The NeoPixels are designed for the Arduino and its output data voltage is 5V whereas the Raspberry Pi is only 3.3V. By adjusting the input voltage down then it makes a 3.3V data line look bigger than it is. There are other tricks like adding a 3V-to-5V data inverter chip but I’d like to avoid that one if possible.)
I’ve smoke-tested the power supply/ring combination and it’s looking good. To make things easier for this step, I’ve now setup a surrogate Raspberry Pi 3 for testing things but since I only had a leftover 4GB microSD, I was forced to use the no-desktop “Lite” Jessie version of Raspbian. But that’s now ready and I’ll likely have some time this weekend to do a basic blink test.
Pretty stoked about my recent orders from the glorious interweb-of-stuff yesterday. Because, obviously, five Raspi’s are never enough for one coder.
Raspberry Pi Zero W
w00t. It’s a single-core version of, say, the Raspberry Pi 3 as if it were stolen, driven to a chop-shop in east Los Angeles and then people ripped off things like the RJ-45 port, the four full-sized USB ports, the header, half the RAM, etc. So it’s definitely stripped-down by comparison. Looks like the HDMI connector and the two USBs are now their tinier counterparts. I don’t see an audio jack. It still has Bluetooth.
The ‘W’ model (up from the Zero) now includes embedded wi-fi so this ought to be killer. Best of all, it only costs $10 compared to $35 for the Raspi3. Too bad it’s twice the price of the Zero, however. And at 2.6″ x 1.2″ it’s smaller than the ones I’ve had to-date.
What will I do with this? It may very well go into the aquarium project I’m working on.
NeoPixel Quarter-Ring 60 LEDs
I also ordered four quarter rings of NeoPixel(s) to build a lighting rig for the ecosystem-pi project.
The intention is to apply realistic lighting to a closed-system aquarium project throughout the day, adjusting the total lighting to compensate for the measured CO2 levels inside. Basically, the more light, the more plant growth, the more O2 produced and the more CO2 consumed in the process. There becomes a point where too much CO2 is bad for the shrimp so you don’t want to stress them out. And then too little CO2 stresses out the plants.
Digital CO2 Sensor
I was able to find a CO2 sensor for the Arduino which could be tweaked for use in a Raspberry PI project. This particular model also includes relative humidity and temperature for better logging.
So far—since I don’t have any sensors, LED lights and such yet—I’m stuck with the GUI design for the interface at this point and making sure that the shrimp are happy.
Everything in the interface is mocked-up right now but it ought to be fun to get the Raspberry talking to the sensors and adjusting the lighting from programmatic control. A fair bit of research has been done so far in the areas of aquarium and plant health.
But the two shrimp seem happy and have cleaned completely the two plants of their week’s worth of algae in three day’s time.