The outside world...
This week i started playing with GPIO in preparation for connecting a grinder to the current voice software I'm running.
So i started off with playing with the gpio, i just ran a simple script to switch an led on and off using pin 17 (apologies for the horrible bread board layout).
I then disassembled the pepper grinder i bought.
This actually ended up being harder than i expected as the cover over the buttons didn't want to come off. Both screws threaded completely I ended up cutting this cover away as i wasn't going to need it anyway. Once i had this done i unsoldered the connections to the button pcb and removed the leads from the battery and motor of the grinder (well one of the motor leads removed its self). I wanted longer wires for while i played so i figured i may as well replace them completely. I feel like this was actually a mistake as slightly melted the plastic housing on one of the battery mounts when i attached the wire (my soldering skills are basically non existent). The following image shows the pcb for the buttons which i removed.
I had originally planned on using a mosfet to switch the grinder on and off but after putting a circuit together the temperature of the mosfet was far higher than i expected.
I decided that i should have a play with the piface as i could use one of the relays to switch the circuit on and off (the grider circut is 7.2V 4.5A and falls wihtin the 10V 5A limit of the relays). I set the python packages up for piface but using the guide form there PiFace – Install PiFace Digital Software. Once i had the python packages installed and the SPI bus configured i jumped straight in to playing around. The first thing i decided to do was use the leds (2-7) to display a counter in binary. I've chucked the source code into my github if anyone wants to have a look. https://github.com/ChangedLater/aiyprojects-raspbian/blob/aiyprojects/src/counter.py
Turing the leds on and off is simple and an example script would be as follows.
import pifacedigitalio as p
from time import sleep
piface = p.PiFaceDigital()
piface.leds[2].turn_on()
sleep(1)
piface.leds[2].turn_off()
Since this was all pretty simple i decided i would hook the grinder circuit to the relay and trigger it with the voice activation code from last week. The final script can be found here. Getting the Voice activation script turning the grinder on and off was the same as the code block i posted above except using led 0 instead of 2 (the relays run in parallel with leds 0 and 1). The circuit was incredibly simple as the following diagram shows (I swear I'm much better as software development than circuit diagrams...)
A video of the completed voice activation component can be seen here
The biggest thing i have learnt this week is just how much i have to learn in circuit design and electrical engineering, heaps of respect for you guys that do it.
Top Comments