Feather to Pi Zero
Julian Rogers Home Case for Pi Zero and interface pcb Door bell construction Home

Under construction

From Feather to Zero

Previously I intended to use th Adafruit Feather to get my project wifi connected but I am now looking at the Raspberry Pi Zero to solve all my embedded mico-controller problems as 1) it’s only £4 and 2) using VNC, I can remotely control the Zero’s desktop. I intend to run Python control programs with Tkinter GUIs set up to monitor and control the program.

You need a keyboard, mouse and monitor to set up the Zero initially but once you have wifi working, you can dispense with these and use VNC running on a PC (or even a tablet) to write, load and run programs. (Running headless). Running headless you might need to force the video into a bigger than default format to see everything you’ve programmed into the Tkinter window. To do this config.txt has to be edited. In Terminal enter:

Left shows a program running on a Zero to control the brightness of some LEDs using pwm. (This is, I think software pwm which, perhaps, explains the flickering apparent on low value duty cycles - the processor has so much else to do as well as generating some pulses that it sometimes can’t run quite on schedule.)

The program is in Python with a Tkinter GUI. There are an option list and a slider widgets to control the pwm value (and some buttons which turn some GPIO pins on and off).

The software for this can be found here.

The circuit uses a dual 555 timer (TLC556CN) so I can use two sensors (one for the knocker and one to detect a knock on the grass door). The output from the sensor is enough not to need amplification (although the glass door sensor might, I haven’t tested that yet). A couple of diodes clip any over-voltage and the 1M resistor ensures any lingering charge on the sensor leaks away reasonably quickly. The sensor needs to generate  a bit over two volts to trigger the monostable (the trigger needs to be taken below 1/3 of supply voltage). The +3.3 volts connection needs to be decoupled to ground with a 0.1 microfarad capacitor near the sensor to avoid hum pickup

USB wifi dongle on adapter lead

I designed a pcb to accommodate the dual 555 timer (TLC556CN) and the 40-way connector for the Zero. It all looks quite neat from the top but when I was designing it I forgot I was going to also power some LEDs and I had to use some of the “prototyping” areas which I usually try to include in my designs (groups of three pads joined together) in order to fit the transistors needed to drive the LEDs. I also decided to include a connector for the various cables needed to link up the unit. This resulted in a large amount of connections under the pcb making it a bit of a mess!

The three transistors drive the LEDs with enough current to make them shine brightly. I would normally put the LEDs in the collector circircuit but I had already wired the cathodes together and didn’t want to take things apart. The disadvantage of using an emitter follower circuit is that the transistors are not in their very low resistance state and will be dissipating power in the form of heat which would not be good for a battery powered circuit. The circuit will be mains popwered so it is not a real issue here.

This trace shows the sort of output the GPIOs will see - a 3.3 volt square pulse (plus a few millivolts of noise), about 100 milliseconds long.

Uno kindly providing 3.3 volts to power the circuit!

Pi Zero plugged into circuit.

Ready for testing with the Pi Zero running the Python with Tkinter GUI test/control program

When the piezo is tapped, the software turns this button red.

Real VPN showing the Pi Zero desktop running the Tkinter GUI monitoring the GPIOs.

Piezo-electric sensor.

Pi Zero and circuit out of shot.

Next, a case for the Zero and pcb

sudo nano /boot/config.txt

Set the following:

hdmi_force_hotplug=1

hdmi_group=2

hdmi_mode=9

hdmi_ignore_edid=0xa5000080

F3 to save, F3 to quit, then sudo reboot. Mode 2 gives 800 x 600 which is enough for my application but bigger sizes can be used. (See RPi documentation).