Quad 24V isolated switch for most Odroids

Post Reply
User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Quad 24V isolated switch for most Odroids

Post by mctom »

I made a thing.

It was shelved as a board for XU4, with additional IR sensor, but things have changed and now I'm replacing XU4 with M1 as a project base.
M1 has on board IR sensor so that went away, and 40-pin 2.54mm socket is almost twice as big as its XU4 counterpart, so I could comfortably fit all these screw terminals, finally.

Right! So this is a heavy duty switch designed specifically for 24V, but should work with anything in 12-50V range (LM317 is the limit really).
All switches are low side, so one can switch all sorts of loads like valves, LED strips, motors, heaters, fans, stuff like that. A general rule of thumb is, don't do low side switching with stuff wired to other stuff.
They are isolated, which means they can switch voltage from independent source, with different ground than Odroid's ground. The maximum difference is up to 2500Vrms. That's what the optocoupler's datasheet says. But in case of this board keep it reasonable.

Personally I'm gonna use this to operate the 24V radiator valve and 24V LED strips, all of which support PWM. This board can rapidly switch MOSFETs thanks to dedicated gate drivers.

That pretty much explains why there's a temperature sensor, too. Two footprints allow to fit either LM35 or LM50 and some other pin-compatible models. Both are wired to ADC input and will work within allowed input voltage range as long as you don't decide to bake your Odroid in the oven.
(There is a protection just in case you did).

And finally, screw terminals. You like them on the top? Sure. Maybe on the bottom? Go ahead. Hence why I didn't overlap SMD components with screw terminal footprints.

Stuff is available here: https://github.com/tomek-szczesny/gpio_ ... d_switches
Attachments
2022-11-09-222159_1818x1264_scrot.png
2022-11-09-222159_1818x1264_scrot.png (139.86 KiB) Viewed 761 times
2022-11-09-215326_880x713_scrot.png
2022-11-09-215326_880x713_scrot.png (385.07 KiB) Viewed 761 times
2022-11-09-215344_949x740_scrot.png
2022-11-09-215344_949x740_scrot.png (410.63 KiB) Viewed 761 times
These users thanked the author mctom for the post (total 4):
joerg (Thu Nov 10, 2022 1:43 pm) • odroid (Thu Nov 10, 2022 5:26 pm) • hominoid (Sat Dec 31, 2022 11:11 am) • rpineau (Mon Jan 02, 2023 4:57 am)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
rooted
Posts: 9973
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 778 times
Been thanked: 581 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by rooted »

Very nice, what do you mean by it can rapidly switch?

User avatar
mad_ady
Posts: 11208
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 1059 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mad_ady »

Very nice!

usual user
Posts: 55
Joined: Sat Sep 10, 2022 10:47 pm
languages_spoken: english
Has thanked: 1 time
Been thanked: 17 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by usual user »

Nice thing, it allows the use of PLC actuators. This means that the M1 can be used as a PLC, only equivalent inputs for sensors are missing.

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

rooted wrote:
Thu Nov 10, 2022 1:53 pm
Very nice, what do you mean by it can rapidly switch?
Means that transition from "on" to "off" state should take something in 100ns - 10us range.
Conversely, a simpler gate driver with npn and a resistor, is easier and cheaper to build, but operates relatively slowly and dissipates substantial heat during transition. This is still acceptable in many applications where state transition happens relatively rarely (say less often that once per second).
I wanted to emphasize that this board supports PWM, because not all do. Not sure what frequency is practical, I'm aiming at 100+Hz for LED and 1Hz for heater valve.
usual user wrote:
Thu Nov 10, 2022 3:26 pm
This means that the M1 can be used as a PLC, only equivalent inputs for sensors are missing.
This board might be used with almost anything that has 40-pin GPIO (the temperature sensor will work with a number of Odroids only, though, due to unique ADC input on the header).
I designed isolated inputs too some time ago but didn't find much use for it.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

The design has been updated: Now one optocoupler is used directly (to pull up or down some external logic signals).
I'll be using this to mute my audio amp when idle.

I also uploaded production files on github.
Attachments
2022-11-25-172912_811x692_scrot.png
2022-11-25-172912_811x692_scrot.png (170.69 KiB) Viewed 654 times
2022-11-25-172930_798x552_scrot.png
2022-11-25-172930_798x552_scrot.png (115.65 KiB) Viewed 654 times
2022-11-25-172950_1032x738_scrot.png
2022-11-25-172950_1032x738_scrot.png (46.25 KiB) Viewed 654 times
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

I added an invincible DS18B20 as another temperature sensing option.
The reason why it wasn't included before is simple - the board was previously designed for XU4, and there was no 3.3V logic.

The changes are reflected in the git repo.

The scope of target Odroids has been narrowed down to M1 only, as different platforms may have OneWire interface by default on a different physical pin.
Attachments
2022-11-27-212021_948x715_scrot.png
2022-11-27-212021_948x715_scrot.png (208.99 KiB) Viewed 634 times
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
rooted
Posts: 9973
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 778 times
Been thanked: 581 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by rooted »

If the pin is different on other devices you could add jumpers or dips but I'm sure that would complicate the routing.


User avatar
mad_ady
Posts: 11208
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 1059 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mad_ady »

The default pin can be changed via dtb on every board. Via overlay, or the old fashioned way with fdtput.

User avatar
rooted
Posts: 9973
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 778 times
Been thanked: 581 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by rooted »

Even better

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

I assumed that the "Default onewire pin" can be reassigned programatically and I guess that got confirmed. :)
I wouldn't worry about all that, I don't expect this module to get much attention. :) So I took a liberty to make it tailored to my specific needs.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

Yay, the board has been built!

I decided to mount screw terminals on the bottom and direct optocoupler output on the top.
The board has been built with LM50 temperature sensor and I already regret that. I wanted to use it for measuring room temperature, alas I'm getting grossly inaccurate results.

By the way, there is an error in Wiki, the correct path for reading the ADC value through sysfs is as follows:
sudo cat /sys/bus/platform/drivers/rockchip-saradc/fe720000.saradc/iio:device0/in_voltage7_raw

Raw result averaged over 13 samples is 443.85, which translates to 781mV, which is.. 28.1 deg C.
The reason why I wanted to test that is it's really cold in here tonight.. Certainly not 28.1 :roll:

Oh well, here goes a superposition of all possible error sources: temp sensor, 1.8V reference, ADC itself.. And some amount of M1's self-heating.

I'll try again with DS18B20 tomorrow.
Attachments
signal-2022-12-28-194811_002.jpeg
signal-2022-12-28-194811_002.jpeg (194.16 KiB) Viewed 440 times
signal-2022-12-28-194811_003.jpeg
signal-2022-12-28-194811_003.jpeg (282.69 KiB) Viewed 440 times
signal-2022-12-28-194811_004.jpeg
signal-2022-12-28-194811_004.jpeg (308.9 KiB) Viewed 440 times
signal-2022-12-28-194811_005.jpeg
signal-2022-12-28-194811_005.jpeg (236.71 KiB) Viewed 440 times
signal-2022-12-28-194811_006.jpeg
signal-2022-12-28-194811_006.jpeg (284.04 KiB) Viewed 440 times
These users thanked the author mctom for the post (total 2):
odroid (Thu Dec 29, 2022 2:33 pm) • hominoid (Sat Dec 31, 2022 11:14 am)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
rooted
Posts: 9973
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 778 times
Been thanked: 581 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by rooted »

Nice looking little board, good thing you got it done before new years since it has 2022 on the silkscreen
These users thanked the author rooted for the post:
mctom (Thu Dec 29, 2022 8:44 pm)

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

mctom wrote:
Thu Dec 29, 2022 4:19 am
Raw result averaged over 13 samples is 443.85, which translates to 781mV, which is.. 28.1 deg C.
The reason why I wanted to test that is it's really cold in here tonight.. Certainly not 28.1 :roll:
It gets even better.

I tested the same board and the same LM50 sensor with Odroid N2L. Got a result of 31.1 deg C. :D
I added a DS18B20 sensor, soldered some 15mm above the board, and it reports... 30.0 deg C.

I held the DS sensor in my fingers until it settled at 35.0 deg C, which looks about right - the result is not just shifted 10 deg C up.

I set up a 80mm fan so it blows at both sensors until the temperature has settled at:
LM50: 21.6 deg C
DS18B20: 23.1 deg C

That looks like a believable room temperature.

The conclusion is, this board can measure its own temperature, which has little to do with room temperature. :roll:
On the other hand, I had no idea the heat is so.. contagious. The observed temperature rise clearly comes from SBC itself, as there is nothing that could be hot on my module at this point.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

And the final test, at least for now, was switching 12V loads via sysfs GPIO control, which works just fine. :)
The test took much longer than it should due to a broken power supply cable. Lasted me some 10 years, sigh.

Unfortunately I don't have any 24V loads at hand, so couldn't test that directly, but there's no reason why it shouldn't work.

I expect to use this board somewhere this or next month for:
- Automatic audio amp mute (the direct output)
- 24V radiator fan
- 24V LED ambient lighting of a room (together with an IR remote digested by M1)
- Possibly 24V central heating valve, if a fan control alone won't be sufficient.

EDIT: Tested on ODROID N2L. It turns out most ODROID boards have the same one-wire pin as default.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

ASword
Posts: 240
Joined: Fri Aug 04, 2017 12:48 pm
languages_spoken: english
ODROIDs: XU4, HC1, 2x N2, 2x N2+
Has thanked: 23 times
Been thanked: 6 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by ASword »

Would this work on an N2+?

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

ASword wrote:
Thu Jan 05, 2023 2:34 am
Would this work on an N2+?
Sure, I tested it with N2L which has exactly the same pinout.
And I got 3 more PCBs to spare :roll:
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 351 times
Been thanked: 447 times
Contact:

Re: Quad 24V isolated switch for most Odroids

Post by mctom »

And here are the first mods done to my module.

None of the outputs is wired to SBC's hardware PWM output by default. Thus I added a jumper wire connecting pins #26 and #33, so I can use PWM output (#33) from either ODROID M1 or N2L to drive SW1 output (#26). It is allowable as long as there's no big idea to enable both pins #26 and #33 on SBC as outputs at the same time.

I tested it with a roll of LED strip (24V 60W) at 2kHz and it worked perfectly, no signs of heating up, although I do not have access to thermal camera to prove it.

Another problem was thermal sensor being heated by SBC itself, so I soldered it to about 2 decimeters of IDC wire, which has the same raster of 1.27mm as the original TO-92 package. It works exactly the same, it's a digital device after all.

And finally, I added a diode on SW2, from negative to positive terminal, which is necessary should anyone wish to switch inductive loads, such as fans, motors and so on. I will be using one of the outputs for a radiator fan, so I added it preemptively to protect the MOSFET that could otherwise fail when switching the load off. I used SK24 diode in SMB package, which was too big to fit between the terminal pins, but that's what I had in stock.

The reverse voltage rating of a diode should exceed the input voltage, and similarly, repetitive peak forward current should be higher than the load's nominal input current.
Attachments
signal-2023-01-21-161254_002.jpeg
signal-2023-01-21-161254_002.jpeg (248.73 KiB) Viewed 161 times
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest