User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 4:45 am

jadel wrote:
Tue Feb 26, 2019 2:50 pm
I built the magnet myself and want to run 12V into it, it has 2 ohm resistance so the current will be 6 A.

Electromagnet DIY

I am jealous of someone building an electromagnet himself. So I am also building one myself. I googled the Cool Magnet Man and found his tutorial very good.

Electromagnets - Cool Magnet Man
http://www.coolmagnetman.com/magelect.htm
...
Attachments
cool_magnet_man_2019mar0502.jpg
cool_magnet_man_2019mar0502.jpg (192.35 KiB) Viewed 828 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 12:59 pm

tlfong01 wrote:
Tue Mar 05, 2019 4:06 am
I measured 1 to 4 magnets and found it very tiring to do the measurements, perhaps because (1) the magnet has a big range of values, so the values for 1, 2, 3, and 4 magnets do not add up proportionally, (2) My visual measurements are not accurate at all (I should have used the scope's digital ruler to do the measurements, but I am too lazy to learn). My conclusion is that my results are not reliable and not repeatable.
I can only said that the average inductance is very very roughly 5mH.

Measuring Solenoid Inductance

Now I am moving on to solenoid inductance measurement, and see if it is different from measuring electromagnets, and perhaps finding out anything wrong with my measuring procedures.
...
Attachments
inductance_measure_2019mar0501.jpg
inductance_measure_2019mar0501.jpg (161.24 KiB) Viewed 812 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 2:23 pm

tlfong01 wrote:
Tue Mar 05, 2019 12:59 pm
My conclusion is that my results are not reliable and not repeatable.
I can only said that the average inductance is very very roughly 5mH.

Measuring Solenoid Inductance - Unsatisfactory Results

I measured 4 solenoids, from 0.8N to 20N. The results is not satisfactory at all. Two solenoids find Vr leading instead of lagging Vs. I guess perhaps the coil's internal resistance is relative bigger than average, and make the measurements unreliable.

Anyway, I found the inductance values roughly 3 to 4mH.

...
Attachments
solenoid_inductance_2019mar0501.jpg
solenoid_inductance_2019mar0501.jpg (186.71 KiB) Viewed 802 times
I am an electronics and smart home hobbyist.

jadel
Posts: 18
Joined: Tue Feb 26, 2019 2:33 pm

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 2:29 pm

Thanks for the help everyone got it working.
Just curious if I wanna have more than one magnet does each need it's own power supply or could I use the same one for more than one magnet.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 2:32 pm

jadel wrote:
Tue Mar 05, 2019 2:29 pm
Thanks for the help everyone got it working.
Just curious if I wanna have more than one magnet does each need it's own power supply or could I use the same one for more than one magnet.
All magnets can share the same power supply, if total power is not exceeded.
I am an electronics and smart home hobbyist.

jadel
Posts: 18
Joined: Tue Feb 26, 2019 2:33 pm

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 2:42 pm

tlfong01 wrote:
Tue Mar 05, 2019 2:32 pm

All magnets can share the same power supply, if total power is not exceeded.
Would the circuits be similar to the one for a single magnet or would I have to make big adjustments?

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 2:57 pm

tlfong01 wrote:
Tue Mar 05, 2019 2:23 pm
the average inductance of the electromagnets is roughly 5mH.
the average inductance of the solenoids is roughly 4mH.

Finding Energy Stored in Solenoids

Now that I have a rough idea of the order of the inductance of the electromagnets and solenoids I am playing with is around 3 to 5mH, I can now calculate the energy stored using the formula below. Then I can select a big enough flyback diode.

But I have little confidence that my measurements are correct, because I am using a cheap function generator and my measurements using human eye, instead of scope doing the measurement and calculation (phase difference between Vs and Vr etc) is far from professional, and can only be treated as an appreciation of basic inductance concepts and experiments at undergraduate level. (After all the readings and experiments, now I appreciated the use of the mysterious j "operator", which previously I wrongly thought that j was an "unit"! :mrgreen: )

Anyway, let me now trying to calculate the energy stored in the electromagnet ZYE1-P20/15 DC6V 0.5A.

Apply the formula, assuming inductance 5mH, current 0.5A, the energy stored is:

E = 1/2 * 5mH * 0.5A ^ 2
= 0.5 * 5 * 0.001 * 0.5 * 0.5
= 0.000625 J (not sure if the unit is Joule! :mrgreen: )
= 625 uJ ??? (not proofread, because I cannot count more than 5 zeros!)

I have no confidence that I am doing anything meaningful. So I think I better stop here and just use the flyback diode I think OK - 1N5822, which I found is also being used OP's SaintSmart realy board! :mrgreen:

...
Attachments
energy_in_inductor_2019mar0402.jpg
energy_in_inductor_2019mar0402.jpg (115.81 KiB) Viewed 777 times
Last edited by tlfong01 on Wed Mar 06, 2019 9:30 am, edited 1 time in total.
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 3:09 pm

jadel wrote:
Tue Mar 05, 2019 2:42 pm
tlfong01 wrote:
Tue Mar 05, 2019 2:32 pm

All magnets can share the same power supply, if total power is not exceeded.
Would the circuits be similar to the one for a single magnet or would I have to make big adjustments?

which the one? :mrgreen:
I am an electronics and smart home hobbyist.

jadel
Posts: 18
Joined: Tue Feb 26, 2019 2:33 pm

Re: Connecting electromagnet to pi

Tue Mar 05, 2019 4:58 pm

tlfong01 wrote:
Tue Mar 05, 2019 3:09 pm


which the one? :mrgreen:
Attachments
due.PNG
due.PNG (9.39 KiB) Viewed 753 times

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 12:58 am

jadel wrote:
Tue Mar 05, 2019 4:58 pm
tlfong01 wrote:
Tue Mar 05, 2019 3:09 pm
which the one?

Big Picture and Long Description Please! :mrgreen:

Oh my goodness, you speak like my girl friend - shorter than her mini skirt. I wish you speak like my grandma, longer than her wrinkles. :mrgreen:

Big/Long Example
https://www.raspberrypi.org/forums/view ... 0#p1437206

Remember we want information - no information no help. The use of crystal balls & mind reading is not supported - pcmanbob

Longer - Dan Fogelberg - 6,037,889 views
https://www.youtube.com/watch?v=5Go6I2_PpBU
Last edited by tlfong01 on Wed Mar 06, 2019 9:28 am, edited 1 time in total.
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 5:54 am

tlfong01 wrote:
Tue Mar 05, 2019 2:57 pm
the average inductance of the electromagnets is roughly 5mH.
the average inductance of the solenoids is roughly 4mH.
Finding Energy Stored in Solenoids
Anyway, let me now trying to calculate the energy stored in the electromagnet ZYE1-P20/15 DC6V 0.5A.
E = 1/2 * 5mH * 0.5A ^ 2
= 0.5 * 5 * 0.001 * 0.5 * 0.5
= 0.000625 J (not sure if the unit is Joule! :mrgreen: )
= 625 uJ ??? (not proofread, because I cannot count more than 5 zeros!)

Flyback diode for Songle 5V Relay

Now I want to know the energy stored in the Songle 5V relay, then select a Schottky diode strong enough to swallow the flyback in one bite.
...
Attachments
songle_relay_2019mar0601.jpg
songle_relay_2019mar0601.jpg (136.03 KiB) Viewed 720 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 6:29 am

tlfong01 wrote:
Wed Mar 06, 2019 5:54 am
Flyback diode for Songle 5V Relay
Now I want to know the energy stored in the Songle 5V relay, then select a Schottky diode strong enough to swallow the flyback in one bite.

Songle 5V Relay Inductance ~= 40mH
...
Attachments
songle_inductance_2019mar0602.jpg
songle_inductance_2019mar0602.jpg (167.77 KiB) Viewed 717 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 6:36 am

tlfong01 wrote:
Wed Mar 06, 2019 6:29 am
tlfong01 wrote:
Wed Mar 06, 2019 5:54 am
Flyback diode for Songle 5V Relay
Now I want to know the energy stored in the Songle 5V relay, then select a Schottky diode strong enough to swallow the flyback in one bite.
Songle 5V Relay Inductance ~= 40mH
...
Attachments
songle_inductance_2019mar0603.jpg
songle_inductance_2019mar0603.jpg (172.15 KiB) Viewed 717 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 7:07 am

tlfong01 wrote:
Wed Mar 06, 2019 6:36 am
tlfong01 wrote:
Wed Mar 06, 2019 6:29 am
tlfong01 wrote:
Wed Mar 06, 2019 5:54 am
Flyback diode for Songle 5V Relay
Now I want to know the energy stored in the Songle 5V relay, then select a Schottky diode strong enough to swallow the flyback in one bite.
Songle 5V Relay Inductance ~= 40mH
...

Energy Stored in Songle Relay = 100uJ

Now I know the inductance of the Songle relay is 40mH, and the current is 70mA, I can calculate the energy stored in the relay.

E = 1/2 * (L * (I^2))
= 0.5 * 40mH * 70mA * 70mA
= 0.5 * 40 * 70 * 70 * 10^-9
= 98uJ
~= 100uJ (no proofread, because I cannot count more than 5 zeros! :mrgreen: )

Appendix - Songle Relay References

Songle Relay Characteristics
https://www.raspberrypi.org/forums/view ... 5#p1326822

Songle Relay Characteristics
https://www.raspberrypi.org/forums/view ... 5#p1324588

KY019 Sognle Relay Circuit
https://www.raspberrypi.org/forums/view ... e#p1422847

Optocoupler EL817/EL354
https://www.raspberrypi.org/forums/view ... 0#p1340670

KY019 Total Optical Isolation
https://www.raspberrypi.org/forums/view ... 0#p1340703

Forbes Relay Board
https://www.raspberrypi.org/forums/view ... 0#p1340696

MCP23017 + ULN2803 Relay Circuit
https://www.raspberrypi.org/forums/view ... 5#p1325530

Old Relay Posts to Refresh Memory
https://www.raspberrypi.org/forums/view ... e#p1357461
Attachments
energy_in_inductor_2019mar0402.jpg
energy_in_inductor_2019mar0402.jpg (115.81 KiB) Viewed 707 times
I am an electronics and smart home hobbyist.

jadel
Posts: 18
Joined: Tue Feb 26, 2019 2:33 pm

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 10:22 am

tlfong01 wrote:
Wed Mar 06, 2019 12:58 am

Big Picture and Long Description Please! :mrgreen:
My question is more about a general possibility. Could I control let's say five electromagnets using one relay board and one power supply?
(while supplying each magnet with about 12V)

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 11:56 am

jadel wrote:
Wed Mar 06, 2019 10:22 am
tlfong01 wrote:
Wed Mar 06, 2019 12:58 am
Big Picture and Long Description Please! :mrgreen:
My question is more about a general possibility. Could I control let's say five electromagnets using one relay board and one power supply?
(while supplying each magnet with about 12V)

Big Picture and Long Description Please!
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 2:04 pm

tlfong01 wrote:
Wed Mar 06, 2019 6:29 am
Songle 5V Relay Inductance ~= 40mH

Songle 5V Relay Toggling at 1 Hz

Songle relay 2019mar0601
https://youtu.be/XZxZ5fhoK9o (youtube)
...
Attachments
relay_buzzer_2019mar0601.jpg
relay_buzzer_2019mar0601.jpg (186.39 KiB) Viewed 645 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 2:33 pm

tlfong01 wrote:
Tue Mar 05, 2019 1:10 am
tlfong01 wrote:
Mon Mar 04, 2019 6:18 am
No flyback diodes across relay switch


ULN2803 Output Clamp Diode passes relay flyback current

ULN2803A Darlington Transistor Arrays Datasheet - TI
http://www.ti.com/lit/ds/symlink/uln2803a.pdf
...
Attachments
uln2803_output_clamp_diode_2018mar0601.jpg
uln2803_output_clamp_diode_2018mar0601.jpg (168.09 KiB) Viewed 636 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Wed Mar 06, 2019 3:00 pm

tlfong01 wrote:
Wed Mar 06, 2019 2:04 pm

50Ω 17mH Electromagnetic Buzzer Testing

Electromagnetic Buzzer Testing
https://youtu.be/EFLLeVPuYbs (youtube)
...
Attachments
relay_buzzer_2019mar0601.jpg
relay_buzzer_2019mar0601.jpg (186.39 KiB) Viewed 628 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Connecting electromagnet to pi

Thu Mar 07, 2019 7:23 am

tlfong01 wrote:
Wed Mar 06, 2019 3:00 pm
50Ω 17mH[/b][/color] Electromagnetic Buzzer Testing

6Ω DC3V~6V TT Motor Induceance Measurement - Unsatisfactory

I found the inductance of the motor roughly 2mH. Perhaps because the coil resistance is too small, so the measurement is difficult to make. I found Vr even leading Vs. I guess there is something wrong with my setup or procedure. Anyway, I think the order of 2mH is 50% OK. :mrgreen:
...
Attachments
tt_motor_inductance_2019mar0701.jpg
tt_motor_inductance_2019mar0701.jpg (195.17 KiB) Viewed 610 times
I am an electronics and smart home hobbyist.

Return to “Automation, sensing and robotics”