Hey guys,
I'm a bit of a n00b with regard to Arduino and electronics.
I have an UNO board and I want to program it to control 4 electromagnets (only turning them on/off).
The magnets don't have to be too strong, but strong enough to attract a small metal ball from a ~10cm distance.
(Basically the goal is to pass the ball around between the magnets.)
My questions are:
• What type of electromagnet should I use? Are there any cheap types that would work for my application?
(I live in the UK).
• If not, then what if I build one? A standard coil/battery/bolt one. Would that be compatible with the Arduino?
• How would I connect the electromagnets to the Arduino?
The code wouldn't be too much of a problem once I get the basic installation done.
You'd connect/wire your electromagnets using a Logic Level Mosfet to turn on/off the magnets. The Mosfets will act like a switch, controlled by the Arduino.
You'd need a lot of power to turn on/off this electromagnet. 5 Volts wouldn't cut it. So a separate PSU just for powering the electromagnets is recommended.
Yes, you can try building your own electromagnet. It's not rocket science. I don't understand your question "would that be compatible with Arduino?" -- what exactly do you mean by that question?
You will almost certianly need a separate power supply for the electromagnets as the Arduino can only source or sink 40mA per pin (20mA to be safe). You can use a transistor or relay between the ecternal supply and the coils to supply enough current. It would probaby be easier in the long run to wind them yourself (bolt and slow powerdrill) to find the number of turns that work the way you want. Use a battery and resistor with your test coil and when you find out what works, calculate the current and with the voltage known you can choose a transistor or relay.
So, what kind of PSU would you recommend? And does the PSU connect to the Mosfet? (sorry again, noob here).
So I'm trying to visualize how this all connects up:
• 4 Mosfets (to 4 Arduino pins? not sure which ones...)
• PSU (connects to the Mosfets? would I need multiple PSUs because 4 magnets?)
• Transistor (any specific type? Connects to the PSU/or Mosfet? and also to the coils?)
• A bolt with coil around it (connects to transistor? or Mosfet?)
Sorry again if the questions are too basic. I'm sure I'll get the hang of it once I play around with it. I just want to purchase the right stuff from the start.
one external PSU connecte to 4 coils. Thransistor, MOSFET for switches. Since I have not used MOSFETs yet I can only speak for transistors. I would use an NPN transistor with the emitter connected to ground, collector to one end of coil, resistor (if required) connected to other side of coil or other side of coil connected to V+. The base of the transistor connected to a digital output through a 1K resistor. MOSFET is probably the better way to go but I've not use them but I'll bet someone who has will give you the lowdown. The specification of whichever will depend on the current that you need to generate the magnetic field strength required.
Any Arduino pin can be used to control the mosfet gate. You would prefer to use PWM-capable pins so you can modify the amount of current going through your electromagnets. See analogWrite().
Be sure to include a diode with your electromagnets per the site's instructions on using them with motors or solenoids.
The 10 cm distance from the magnet to the steel ball is a long distance to lift up against gravity.
If the ball is to be traveling on a flat horizontal surface it is easy. Is it horizontal?
The mass of the steel ball is not known. Is it less than a gram?
Will you repel and attract the ball? If yes, then the driver MOSFETS should provide negative coil current and positive coil current.
Use a 24 volt power supply with 200 watts, 8 amps
Use op amps to shift 5 volt Arduino to 24 volts
Use power MOSFETS like
n-channel FQP19N20
p-channel FQP17P10 Fairchild
Four MOSFETS per coil, 16 total MOSFETS,
8 n-channel
8 p-channel MOSFETS
Drive 2 coils only at a time, 4 amps each
connect Arduino digital port bits 0, 1, 2, 3 to op amp inputs that use 24 volts power supplies. Use a 2.5 volt regulator to the negative pin on op amp, use 5 volt digital port bit to positive op amp input. Drive MOSFET gates with op amp outputs. The MOSFETs are OK with 24 volts on their gates.
AmbiLobe:
The 10 cm distance from the magnet to the steel ball is a long distance to lift up against gravity.
If the ball is to be traveling on a flat horizontal surface it is easy. Is it horizontal?
The mass of the steel ball is not known. Is it less than a gram?
Will you repel and attract the ball? If yes, then the driver MOSFETS should provide negative coil current and positive coil current.
Use a 24 volt power supply with 200 watts, 8 amps
Use op amps to shift 5 volt Arduino to 24 volts
Use power MOSFETS like
n-channel FQP19N20
p-channel FQP17P10 Fairchild
Four MOSFETS per coil, 16 total MOSFETS,
8 n-channel
8 p-channel MOSFETS
Drive 2 coils only at a time, 4 amps each
connect Arduino digital port bits 0, 1, 2, 3 to op amp inputs that use 24 volts power supplies. Use a 2.5 volt regulator to the negative pin on op amp, use 5 volt digital port bit to positive op amp input. Drive MOSFET gates with op amp outputs. The MOSFETs are OK with 24 volts on their gates.
Amazing. Thank you so much for your help.
It will be a small flat surface. The ball can be very light (the lightest I can find). The idea is to just pass around this ball between four magnets, so I guess I would only need one magnet turned on at any time and only need them to pull.
I actually ordered four FQP50N06L MOSFETs before I read your comment. Hopefully that'll be okay. But why would I need 4 per coil?
The smallest balls can be 1mm ball bearings.
The short distance can be 1 mm between coils.
The whole board can be one square centimeter.
Then small currents can be used instead of 4 amps, use 0.4 amps in each coil.
The MOSFET you ordered is a good choice because the threshold voltage is 2 volts and op-amps are not needed to increase the voltage above 5 volts. It can handle 50 amps but you only need .4 amps for tiny balls in 1 cm apparatus. The coils will have low resistance like 0.5 ohms
v = ir
5v = i .5ohm
i = 5/.5 = 10 amps if no resistor is added.
to get 0.4 amps use series resistor
r = v/i = 5/.4 = 12 ohms
power = iv - .4 5 = 2 watts resistor size
power supply : 4 coil times 2 watts = 8 watts.
Use one MOSFET per coil if only attraction from the magnetic coil is wanted. To have magnetic repulsion and attraction would use four.
These values described are for a miniature apparatus, larger ball bearings and bigger sizes will scale up the power and current needed.
For 20 gram balls moving 10 cm use 4 amps and re-calculate as above.
r = 5v/4A = 1.2 ohms series resistor to limit the current drawn by the MOSFET.
power iv = 4A x 5V = 20 watts
four coils x 20 watts = 80 watt power supply at 5 volts.