Automatic Fish Feeder - Part 4
Conclusion
The reason this took me so long to put together was the debugging.
Leave yourself slack.
My first problem was trying to solder everything as compact as possible, even though I had a lot of excess space on the perfboard. If I had etched a PCB, this wouldn't really have been an issue. But perfboard prototypes tend to be a bit more chaotic. Organization would have helped tremendously. My reasoning for soldering so tightly was that I wanted room for expansion, which is ridiculous. This is especially true since I could have just run wires to another perfboard if I were to expand.
Use a soldering heatsink, and take your time.
I burned out a MOSFET by applying too much heat. Because everything was so tight, it was difficult to probe to even find this problem. I tend to solder quickly. Normally, I put a few components on the board, bend the leads, flip the board over, and solder pins one pin at a time on each device. This way, the device can cool between each joint, and I don't overheat the device. However, when all the ground pins of all my transistor drivers are supposed to be soldered together in close proximity, I need to leave more time because heating one joint will heat all of the transistors. I didn't, and one blew, creating a short. It was also difficult to replace because of how tightly I soldered them.
Connectors are useful, but they are another point of failure if used improperly.
Connectors are a blessing and a curse. I soldered male pin header on the leads of the stepper motor. By doing this, I was able to breadboard the circuit very easily. My soldering job was terrible, though. When I soldered, the plastic of the connector melted slightly. This made the pins jagged rather than straight, and one pin even slid in and out of the connector. Some joints were either cold soldered or broke off completely. The female header on the perfboard had a loose connector inside the plastic, resulting on no connection when the male pin was inserted. I got a whole lot of these connectors on eBay for about $2. I got what I paid for.
Clock drift matters over long periods of time.
I set the feeder to dispense food every 12 hours. This worked: it fed the fish at 9 AM and 9 PM. After a week or two, however, it fed the fish at 1 PM and 1 AM. This is because I used the microcontroller's internal clock. The documentation says that this clock isn't very accurate; use a crystal oscillator for precise applications. I didn't think it would be a very big deal. It is.
I knew there would be a few milliseconds of overhead that would accrue over time because of the way I designed the code to flow. It was nothing compared to how much the internal clock was off. There is a way to calibrate the clock, but I lack the tools, time, and care to do that.
Make things modular first, then integrate them.
Originally, I planned on expanding so I would command the fish feeder to feed from my PC over RF. This would have nullified the point about since I could just feed the fish with a cron job. My PC started overheating all the time. My PC was less reliable that the fish feeder, so the idea was scrapped. I spent a lot of time sloppily trying to get RF to work. It failed. Luckily, since the hardware design didn't solely rely on the RF, I was able to cut the RF out completely and still complete the project.
Now, since I'm working on the RF again for an RC tank/car, I can duplicate the RF I'm working on now and add it to the fish feeder. Modularity helps, but if you go overboard it becomes its own burden and its own project, but if done properly the bit of extra time you spent will save you a lot of hardship over time.
Paper and water don't work well together.
I'm just stupid for this one. My fish get overly-excited for food sometimes. The tinfoil barbs sometimes make a splash when they swim to grab a few flakes. The paper I used as a funnel started to get wet and wrinkle. It's not smooth anymore, and it becomes more discolored and dirty over time as food sticks and melts into it. I need to use small plastic walls on the sides rather than paper.
In the end, the feeder was worth building. I learned a lot about "real" applications rather than just the electronic daydreams I think I can put together in a weekend. There are always problems that you don't foresee; I knew that. I learned that I should design a circuit that is easier to debug than to put into production. After all, I only planned on making one of these, but I planned it like it was going to the factory next week. Lesson learned.