inductive current flow control

Hello All I am working on a project with my son. Well I'm doing it and he solders and watches. His hands don't shake like mine do.

What we are doing is making an electric motor. I have some magnets embedded into some plastic pipe with end caps. End caps are drilled at the center for an axle. The magnets are equilateral around the pipe in multiples of 4. I have a 2 hall effect sensors that tell me where the magnets are. I also have electromagnets at positions related to the positions of the magnets. When the first hall sensor "sees" the magnet the electromagnet turns on with the polarity to pull the magnet towards it. When the second hall sensor sees the magnet and the first is also on the electromagnet turns off. When the second hall sensor still sees the magnet but the first does not I switch polarity of the electromagnet and push the magnet on the pipe.

That's the setup now here is my question. I have a coil in the electromagnet. A voltage can be produced in the winding when the magnetic field collapses. This usually is dealt with by placing a diode across the coil. The problem is I will be switching the polarity of the coil by changing the direction of current flow. So what do I do abut the diode that needs to control the current in both directions?? A diode only works in one direction.

The only thing my limited understanding can come up with is a bridge rectifier. There are four poles on the bridge. Two would normally have an AC current across them and dc out the other two. If I send power to the electromagnet through the two poles that would normally have ac this would excite the magnet. And when I switched the polarity on those poles it would switch the magnet as well. But what happens when I turn off the magnet and the field collapses? Does the bride protect my arduino like a diode would in a simple circuit?

The old gray mare ain't what she used to be.

This looks relevant: http://modularcircuits.tantosonline.com/blog/articles/h-bridge-secrets/practical-h-bridge-design-part-1/

Also be aware that in a motor the field often cuts several windings so turning off one winding induces a complementary change in current in the other coils rather than generating massive voltage spikes - in other words there is mutual inductance as in a transformer.

Thank you John and Mark. John I read the stuff you pointed me at. It's just getting deeper. I am up to my neck now. All I wanted to do was make a simple permanent magnet motor to show my son, he's 12, how they work.

I read a bunch of stuff about mosfets, igbt transistors and bjt transistors. All of it was actually interesting, probably shows I have no life, but I have a very real problem in choosing the proper device. I have no idea how much voltage I am trying to control! I do know that in an automotive coil, another inductive device, the output is relevant to the resistance of the secondary circuit. That's why people gap the spark plug. Ohm's law seems to pop up everywhere.

In my situation the only real resistance is in the magnet wire wrapped around the electromagnets. Now the amount of coils will be a lot so the resistance might be an ohm or two. But probably less then an ohm. And I have looked at the cost of some of these components. I don't think I want to spend thirty dollars to protect five dollars of parts.

So here is my solution. I am going to have two pins for output from the processor. I am thinking of using an ATtiny if I can program it. These two pins will go through diodes that allow current to flow out of the processor but blocks it flowing back in. Also I think I will use a socket for the transistors. If they blow out I will just pop another back in and maybe scratch my head some more.

I asked my son how he felt about making a motor that uses a processor. He said "Cool, what will we do with it?" It wasn't enough to make the motor. It had to be used for something to make it interesting. So Sparkfun sells some wheels and I think we will make a car to put it in.

A bridge rectifier could be used as a damper by connecting the AC terminals to the windings and the DC terminals to the power supply bridge + to DC+ and bridge - to DC-. ITs the same thing you have with a H Bridge, just typically you use 4 descrete diodes situated one per output transistor.

Thanks all for the help. Sorry I didn't get back to you sooner. I had a bit of a problem. I changed the Linux distro I used on my laptop, it would compile the avr stuff yes I know I could have added what I needed but I didn't like it anyhow. I had all 465 gigs backed up. Then I found out the main problem with a gui. I highlighted the icon to deleted the files I had put on the Hard Drive, I wanted them in a different place and thought I would just delete and reinstall.. But I mistakenly highlighted the backup drive. They both looked the same in the gui. And then deleted all 465 gigs of my backups. I think I will be using the command line from now on, as I usually do. Thank you all for your help.

Addition.

I have been using a Honeywell hall non-latching sensor in a sot-23 package. This is a surface mount that if it was any smaller I would need a microscope. But the ten power magnifier does work OK. The first one I did, sensor on a breakout board, worked like a champ. I thought "Man this is simple." Then I couldn't make another to save my life. All sorts of strange things happen. The last thing is I have very fine "dots" of solder all over the board. I thought solder was only supposed to stick to the traces? But that is not what happened. If it was still Christmas I would hang it on the tree. Another time I got a ball of solder that bridged the side with two pins. The ball of solder was bigger then the part itself. I tried to use wick and desolder it but the sensor just jumped up and ran away and I lost it. I think I finally got a good one late last night. I haven't had time to test it but it looks good. All I need is two so that should do. If it works of course.

Thanks again for all your help. I really do appreciate it.

Soldering SMD chips on breakout boards with a soldering iron is tricky if the pin spacing is less than 1mm. I generally use solder paste and a hotplate instead. I've recently ordered a small gas soldering iron with hot air attachment, which should work with solder paste too.

Solder bridges are not difficult to remove with solder wick, but you should solder all the pins on the device before dealing with the bridges - that way it won't escape. Also, invest in a "Helping hands" or similar to hold the work securely.

Here's a bench technician's tip on smd. Don't try to "solder" the leads, rather thouroughly tin the board lands and then clean the tip on a wet sponge. Position the part and reflow the solder left on the land from the "tinning", clean tip between each use, there will be adequate solder to attach the component, but not enough to bridge.