Date: Wed, 5 Oct 2005 02:47:39 -0500 (CDT) Subject: small enlightenment in electronics X-UID: 95 Content-Type: IMAGE/JPEG; NAME="img1859.jpg" Content-Type: IMAGE/JPEG; NAME="img1860.jpg" I know the motor control board works now. It just doesn't work as I originally expected. I had a fundamental misunderstanding of how a MOSFET works. More accurately, I did not pay attention when reading about semiconductors in my electronics book. MOSFETs are only good for switching motors that operate at around 12 volts or higher. For lower voltages, a bipolar circuit is required. This is why servo circuits don't use MOSFETs. My original plan was to use a modified cordless screwdriver as the steering motor. It was the right size and easy to modify. It operates at 3.6 volts. This won't work as the minimum drain to source voltage I see on the datasheet is 4.5 volts. Given that the path from anode to ground runs through two transistors in an H-bridge, that means anything less than around 10 volts won't be enough. There are four solutions. 1. Use a bipolar motor control circuit 2. Replace the cordless screwdriver with a higher voltage tool 3. Place some big resistors or diodes in series with the motor 4. Do nothing I will probably do nothing. Even though the motor will be overvolted, the duty cycle will be far less than 100%. So the motor may survive despite operating at several times its rated voltage. I just have to make sure that the microcontroller never drives the motor too hard (otherwise it will burn out). Basically...the last few days have been a reality check. I realized today that my knowledge of electronics is about where beginning computer programmers are (not "software engineers" or "developers" but rather the old "computer programmer" term). In electronics, I will make design and planning mistakes akin to using gotos, global variables, and deep inheritance trees. I will downcast and pass pointers around, mixing different memory management strategies in the same system. I will eschew an external interface and have the underlying code call into itself recursively. In electronics, design and implementation cost is dominated by: 1. wiring and interconnects 2. interfacing Components are relatively cheap. If I could do this over, I would have planned the wiring out. I probably would have used a printed circuit board. And I would have tested interfaces between parts of the circuit instead of assembling the entire thing (ala waterfall methodology) and troubleshooting it. I found three mistakes over the last few days: 1. miswired microcontroller I/O pin 2. forgot to connect opto-isolator ground pins to logic ground 3. forgot to connect H-bridge grounds together These happened because of inexperience and a lack of understanding of circuit functioning. When I've heard the "car talk" guys or a NASA engineer talk about faulty instrumentation or other problems, they'll often say "look for a loose ground wire". What does that mean? Sounds cool, kind of macho. The meaning comes from our conventions for electricity. Most low speed electronics and electrical circuits use "single-ended signaling". That means the sender and receiver share a reference ground and communication occurs over one wire. It greatly simplies conceptualization of a circuit to imagine a shared ground everywhere. It is the absolute reference frame. So if a connection to ground comes loose, then the reference frame is lost as is information in the signal. Two of the mistakes I made were of this nature. I forgot to connect the ground wire. There have been a whole bunch of frightening accidents. Tonight I typed: avrdude -p 8515 -c stk500 -C /optstuff/etc/avrdude.conf - I wanted a "-t" on the end but mistyped. So the microcontroller programmer writes a bunch of junk into the microcontroller. Now I can't initialize programming mode. I thought that some firmware on the programming board was messed up. As it turned out, it's pretty simple to get out of this. But I saw many other Google posts (and not one good solution or explanation) about this same problem. Yesterday, I was trying to drive the opto-isolators directly from the GPIO pins on one of the computer boards. It wasn't working. The problem is that the GPIO pins on those boards can not source much current, only 3 ma. The opto-isolators draw around 10 ma on the logic side to switch. So even when set high, the GPIO pin would be pulled down to about 1 volt, the voltage dropped across the diode. The oscilloscope is invaluable. It is a very powerful tool that saves time. It is roughly equivalent in value to a milling machine for fabrication. It allows you to do things that would otherwise require superhuman effort. In regards to both of these tools, I can almost say that it is difficult to spend too much - the extra power for the money will be worth it. I'm going on vacation again starting Friday and through next week. So I'll mostly be in San Francisco. This time, I'll make it. I've dreamed about both the Bay Area and robots recently so it will be nice when it comes true in reality.