Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Running LED circuit, but with electromagnets

RudiJ

New Member
Hi there. I want to build a running LED circuit, but I want to replace the LED's with electromagnets (about 4 of them). I will use an Arduino Uno for this project, but I'm not sure how to proceed as the circuit would require protection from feedback etc. The only video's I can find uses 1 solenoid in combination with a mossfet. Any help would be much appreciated. I'm just an electronics enthusiast, so the simpler the better.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
You would need a power FET to control each electromagnet, rated for somewhat more current than you expect the magnets to take.
The FETs should be "logic level" types if you want to control them directly from the Arduino; otherwise you will need an extra drive circuit for each gate to boost the gate voltage to around 10 - 12V.

You also need a "flywheel diode" across each electromagnet coil.

This shows the outline circuit you would need for each electromagnet - it would connect in place of the relay coil:
articles-switch10.gif


Example logic level FETs:
 

RudiJ

New Member
Thank you so much for your response Mr. Jenkins. I would use external 9 to 12V for the electromagnets. Am I on the right track with the image below?
1650011247133.png
 

Pommie

Well-Known Member
Most Helpful Member
You'll need logic level MOSFETs. I think there's an IRL610 available. Will it be using PWM?

Mike.
edit, the IRLZ44 seems popular with Arduino enthusiasts.
 
Last edited:

Nigel Goodwin

Super Moderator
Most Helpful Member
You'll need logic level MOSFETs. I think there's an IRL610 available. Will it be using PWM?

Mike.
edit, the IRLZ44 seems popular with Arduino enthusiasts.

And doesn't switch fast enough for PWM fed from an Arduino, you need drivers - hence my circuit in one of the previous threads.

But switching solenoids is a relatively slow process, so speed shouldn't be an issue, and the IRLZ44 should be fine.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
Am I on the right track with the image below?
That's good - as long as its only on-off control and you use a suitable logic level FET, as mentioned above.

It would probably be a good idea to add a low value resistor between the 10K connection and the FET gate, just to reduce the current surge when the MCU output switches on or off; eg. 470 or 330 Ohms.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
The standard PWM on an Arduino runs at 490Hz.

Mike.
Edit, even I (deaf as a door nail) can hear them motors sing.
Mine runs at 124KHz, so no whistling - and even I can hear 490Hz - however, back at school long ago, in Biology we got a frequency generator and a speaker (from the Physics lab). The teacher set it up, set too high to hear, and gradually would it down - and told us to put our hands up when you could hear it - needless to say, it was the girls who were the first to hear it.

Eventually he said, right now put your hand up if you CAN'T hear it - and I was the only one - winding it down further, I couldn't hear until it got to 13KHz.

You can of course easily alter the PWM on the Arduino, but it completely messes up the Delay() function, so you have to alter all the values.
 

RudiJ

New Member
Thanks again for all the input. in relation to the electromagnets/ solenoids, I wish to switch them very fast. Is that an issue?
 

RudiJ

New Member
Hi. I'm not using solenoids per say, only electromagnets. So there's no moving parts. When I say fast, I mean the following loop relating to the electromagnets (EM1 to EM4); EM1 On 100 milliseconds, Off -> EM2 on 100 milliseconds, Off -> EM3 ON 100 milliseconds, Off -> EM4 On 100 milliseconds, Off. The timing of 100 milliseconds is an example and will depend on the timing entered into the Arduino code.
 

Pommie

Well-Known Member
Most Helpful Member
100mS is very slow. PWM is often at on/off times of 100s of thousand times per second.

Mike.
 

Pommie

Well-Known Member
Most Helpful Member
The nearest thing I can think of that's similar to what you're doing is a bldc motor. This does what you're attempting but much much faster.

Mike.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Hi. I'm not using solenoids per say, only electromagnets. So there's no moving parts. When I say fast, I mean the following loop relating to the electromagnets (EM1 to EM4); EM1 On 100 milliseconds, Off -> EM2 on 100 milliseconds, Off -> EM3 ON 100 milliseconds, Off -> EM4 On 100 milliseconds, Off. The timing of 100 milliseconds is an example and will depend on the timing entered into the Arduino code.
As Pommie said, 100mS is VERY slow, so not an issue - 'fast' would be low uS or nS.

People seem to forget (or never understood?) that mechanical items are generally extremely slow, and processors extremely fast - the majority of microcontroller projects probably spend all their time waiting for some thing to happen.
 

Pommie

Well-Known Member
Most Helpful Member
People seem to forget (or never understood?) that mechanical items are generally extremely slow, and processors extremely fast
An example I like to use is a motor turning at 10,000 RPM (very fast) is actually turning once every 6mS in which time a 1MHz (slow) processor can execute 6,000 instructions. Remember, your PC is probably running faster than 2GHz (2,000MHz) so could execute 12 million instructions in that time.

Mike.
 
Last edited:

RudiJ

New Member
Wow. I never realized how fast microprocessors were looking at the comparison above...Thanks for the input gents.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Wow. I never realized how fast microprocessors were looking at the comparison above...Thanks for the input gents.
That's only a VERY old slow processor, my current PIC of choice runs at up to 64MHz - but as with most (all?) PIC's you have a bewildering array of clock options - basically you can sacrifice speed for low power consumption, and with modern devices you can change speed at will in the program. So for example your device could be in standby, with the processor only running at 32KHz (a common ultra low power clock for PIC's), and once it starts doing something it can be switched back to full speed.

Personally I've never had occasion to do that, I simply put the PIC to sleep, and allow it to be woken via interrupts.
 

Latest threads

New Articles From Microcontroller Tips

Top