I'm trying again.
I'm making a digital demand feeder, and I have a few other ideas I'd like to try as well.
I'm using a PICAXE 20M2 chip, And I've managed to get as far as this...
Clicking on the image should make it larger.
If anyone is willing, can you please check my layout to make sure I limit how many chips I toast before I actually start toasting them.
This is the serial data connection from the stereo plug to the chip.
The overlay is what it should look like, the rest is my interpretation.
For people that don't know this stuff, the serial data connection is the bit that makes it possible for me to send information from my computer to the chip.
I write code (computer programming stuff) on my computer on some software provided free by the PICAXE company. When I'm happy with my code I send it to the computer chip (the grey thing that's centre right with all the legs) via a cable that has a USB plug on one end, and a stereo headphone jack on the other. The headphone jack plugs into my project, and the USB end plugs into my computer.
Once you connect the power supply, the chip starts running it's program, and that program typically loops around forever, waiting for external inputs from things like switches, variations in connected voltages, or fish bumping levers.
When the chip detects inputs, it can react according to the code you have written, and produce outputs. (like when your computer displays a box with buttons marked "OK" and "Cancel" , That box is an output, if you click one of the buttons, that becomes an input.
So the code might look something like this...
read this line over and over, unless the fish pushes the lever, then run the rest of the code
power up the feeder motor for 3 seconds
count to a few billion to wait a while so the fish dont get too much feed
go back to the first line
That's roughly what code looks like, but unfortunately computers don't understand English very well, so you have to use very structured language, and code words to make it all work. I wont go into that here.
Here's another bit that connects the lever that the fish will push when they want food...
This time the overlay shows the circuit diagram of a switch and it's connection to the chip.
I'll use a momentary contact switch that is only on when there is pressure on the switch, and reverts to it's natural state - off, when there is no pressure on the switch.
I'll attach a lever that extends down into the fish tank so the fish can press it.
When the fish press the lever they send an input to the chip that sets the code in motion. The code does some calculations and checks to make sure the fish aren't being too greedy, and if all is well, the chip turns the motor on for a few seconds.
The motor section looks like this (I think)...
One form of the chips input and output abilities, is to set the pins "high" or "low". That being high voltage (up to 5 volts) and low voltage down to not very much.
The chip can also receive high and low voltages as inputs.
So we design the circuit so that flipping the switch changes the input from either high to low, or low to high, and then write code that uses the different state to start some other bit of code. The other bit of code might change a different pin from low to high, and trigger the motor.
That code might look something like this...
keep looping this line until the pin the switch is connected to changes from low to high, then...
check that the fish haven't had too many feeds so far today
if they have had too many feeds go back to the first line, otherwise keep going to the next line
set the pin to which the motor is connected to high, to send power to the motor.
add one to the number of feeds so far today
Go back to the start
The computer you are sitting at is essentially just a really, really, really complicated version of that.
The chip I'm using works faster than my first desktop computer, and only costs a few dollars.
Please give some feedback on the design if you are familiar with this electronics caper, as I'm still a bit vague on all this stuff. My greatest problems are around interpreting a circuit diagram onto the breadboard with special regard to shared nodes, where say in that last picture all three components meet at that one point. When I place components on the board, they rarely fall in the same layout due to space restrictions etc. Even the fact that the strip board often creates the need for zig zags rather than straight lines. ie three components in a straight line might need to be stepped with each component and wire on a different horizontal line. This can really mess with my head at times. Another problem I have is with missing track cuts that cause shorts.
I also have many other problems with stuff.
I'm not sure I believe in electricity.
So please help me through this part if you can. There's a comments section under this post, or you can get involved here at Backyard Aquaponics. The project is all open source, and the details of the code, the electronics, and the PVC construction will all be freely available on this blog and at that link.
120 Things in 20 years re-bites off more than it can chew with an electronic, aquaponics manager.
No comments:
Post a Comment