elfernandogordobez
Posts: 2
Joined: Tue Aug 11, 2020 10:42 am

controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 11:12 am

Hi,

In my project I need control a brake system. The system work with dc voltage between 0V and 24V. 0V mean no brake and with 24V, maximum brake pressure is applied. That is, depending on the amount of voltage the brake is applied. Accordingly I need to control dc voltage between 0-24V with raspberry pi 4. I have used Python as language.

I have not sufficient knowledge about electronic side of problem. I have searched and have some suggestion using pwm + ADC(Analog Digital Converter) to achieve this. But, I suppose I need 3.3V input (As far as I know raspberry pins work with 3.3V and max PWM output will be 3.3V.) and 24V output ADC and I cant find any ADC like this. if I can solve the problem with ADC, Can you advice any ADC capable of my problem. if not what kind of electronic device should I use? Is there any other solution of my problem?
thanks,

User avatar
davidcoton
Posts: 5186
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 12:38 pm

You need DAC (Digital to Analogue), not ADC.
DAC will connect via one of the interfaces -- probably i2c but could be others.

Neither DAC nor ADC would use PWM. PWM is not appropriate for your problem, AFAICT.

You will also need to pay attention to make it fail-safe -- if anything goes wrong with the Pi, the output must go to a safe condition, most likely full brake. This is non-trivial and probably important, possibly even critical. You may need to involve an experienced hardware engineer.
Location: 345th cell on the right of the 210th row of L2 cache

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 1:41 pm

You must specify what current the brake requires. It might be quite a high current of the 0 - 24V is directly driving a brake device live a solenoid.

You could use a controllable bench PSU as a starting point.
e.g. https://cpc.farnell.com/tenma/72-2540/p ... dp/IN07294

Controllable with USB or RS232. If you can get docs on that, or run the Windows software and monitor the commands that sends, you could send commands from your code to set any voltage and current you need.

Alternatively you could use a low power DAC and a DC power amp.

Depending n what the load is you might be able to control it with a motor driver controlled by PWM logic signal

emma1997
Posts: 929
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 6:13 pm

davidcoton wrote:
Tue Aug 11, 2020 12:38 pm
PWM is not appropriate for your problem
It's puzzling why you would say that. PWM is by far the most common and efficient way to generate analog voltages. Pi has excellent built-in hardware for that and a simple op amp can scale it to any voltage including 0-24v.

The only question as PiGraham hints is whether the brake has high impedance input and driven directly or if it's a motor needing a buffer/amp.

User avatar
davidcoton
Posts: 5186
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 8:02 pm

emma1997 wrote:
Tue Aug 11, 2020 6:13 pm
davidcoton wrote:
Tue Aug 11, 2020 12:38 pm
PWM is not appropriate for your problem
It's puzzling why you would say that. PWM is by far the most common and efficient way to generate analog voltages. Pi has excellent built-in hardware for that and a simple op amp can scale it to any voltage including 0-24v.

The only question as PiGraham hints is whether the brake has high impedance input and driven directly or if it's a motor needing a buffer/amp.
Well, if you like you can design your own PWM-based DAC. Quicker, easier, and probably simpler to use a commercial DAC on i2c. It might even be cheaper on components, though PWM DAC might win there. So worthwhile in a commercial design -- possibly. Given the OP's stated lack of electronics experience, I think we can rule out a homebrew PWM DAC, unless a hardware engineer becomes involved.
Location: 345th cell on the right of the 210th row of L2 cache

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 8:38 pm

davidcoton wrote:
Tue Aug 11, 2020 8:02 pm

Well, if you like you can design your own PWM-based DAC. Quicker, easier, and probably simpler to use a commercial DAC on i2c. It might even be cheaper on components, though PWM DAC might win there. So worthwhile in a commercial design -- possibly. Given the OP's stated lack of electronics experience, I think we can rule out a homebrew PWM DAC, unless a hardware engineer becomes involved.
The details matter, but PWM DAC can be as simple as a resistor and capacitor on a gpio pin. Add a bipolar transistor and base resistor and you can operate at 24V.

https://www.instructables.com/id/Analog ... o-Voltage/

An i2c can be simple, but controlling a brake device could easily catch out a novice in electronics either way.

emma1997
Posts: 929
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 9:04 pm

davidcoton wrote:
Tue Aug 11, 2020 8:02 pm
Well, if you like you can design your own PWM-based DAC. Quicker, easier, and probably simpler to use a commercial DAC on i2c.
In most situations there is no 'PWM-based DAC' at all, just the raw PWM signal by itself. Things like motors, lights, etc ignore the fast signal variations and treat it like DC. Even devices rated for DC like meters usually have internal filtering so also accept raw PWM. In some cases where clean DC is absolutely demanded then a resistor and capacitor will not break the bank.

In the case of OP an op amp is needed to boost voltage but that would also be the case with hardware DAC.

So, if like BJT v MOSFET where we are eliminating one of the two components, I'd be tempted to say 50% reduction in parts, time, and cost. However since we would be replacing one or more parts with none here, it might be more correct to say INFINITE advantage... lol
Last edited by emma1997 on Tue Aug 11, 2020 9:27 pm, edited 1 time in total.

LTolledo
Posts: 3816
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: controlling 0-24V variable DC voltage with raspberry

Tue Aug 11, 2020 9:25 pm

@OP: can you post the data sheet of the device that requires 0 ~ 24v variable DC.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

elfernandogordobez
Posts: 2
Joined: Tue Aug 11, 2020 10:42 am

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 8:29 am

LTolledo wrote:
Tue Aug 11, 2020 9:25 pm
@OP: can you post the data sheet of the device that requires 0 ~ 24v variable DC.
https://www.emffren.com.tr/Content/EMF_2012_En.pdf

mine is ABT series at the page 18

LTolledo
Posts: 3816
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 8:46 am

from the data sheet provided:
important notes.jpg
important notes.jpg (30.94 KiB) Viewed 501 times
best heed what is written there, so as "not to void warranty"
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 9:57 am

elfernandogordobez wrote:
Wed Aug 12, 2020 8:29 am
LTolledo wrote:
Tue Aug 11, 2020 9:25 pm
@OP: can you post the data sheet of the device that requires 0 ~ 24v variable DC.
https://www.emffren.com.tr/Content/EMF_2012_En.pdf

mine is ABT series at the page 18
That is where you start.
Now we learn that you need to SWITCH up to 8A 24V on or off.
There is no mention of variable control. It's a run / stop device. So you need a power source capable of 8A 24V peak and a controlled switch with comparable ratings. A relay might be an option or an industrial contactor or solid state relay rated for inductive loads.
You don't need a DAC.

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 10:04 am

LTolledo wrote:
Wed Aug 12, 2020 8:46 am
from the data sheet provided:
important notes.jpg

best heed what is written there, so as "not to void warranty"
Good point. This looks like a serious industrial device used on heavy machinery. Besides waranty concerns there are also issues of health and safety, consequences of machine malfunction (maybe costing many £1000s per hour of lost production or product liability.

From the datasheet giving no indication of variable braking by varying voltage is this project trying to use the device in a way it is not designed for? Slipping a brake or clutch is likely to cause excessive heating which is not generally a good idea.


I have to question whether a Raspberry Pi applied by someone who says of themselves "I have not sufficient knowledge about electronic side of problem." coding something n Python is going on the right path.

User avatar
davidcoton
Posts: 5186
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 1:10 pm

Agreed. Controlling that is not a project for the inexperienced. Safety will be near critical, with expensive damage/downtime and possible (serious) injury following any mistakes. Get a control professional on your team.

BTW I only see a maximum continuous current of just over 2A, and I do see that analogue control might be possible (it's designated 0-24V, not just 24V as a binary system might be, and "Torque control" is mentioned).
Location: 345th cell on the right of the 210th row of L2 cache

emma1997
Posts: 929
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 1:20 pm

So to cut to the chase all OP needs is a transistor and maybe diode since voltage is so high. Or relay if it is on-off and 'semi-phobia' rears it's ugly head. Should be easy to test from CLI w/o writing any code.

If variable input is needed then certainly PWM will do the job.

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 2:16 pm

davidcoton wrote:
Wed Aug 12, 2020 1:10 pm
Agreed. Controlling that is not a project for the inexperienced. Safety will be near critical, with expensive damage/downtime and possible (serious) injury following any mistakes. Get a control professional on your team.

BTW I only see a maximum continuous current of just over 2A, and I do see that analogue control might be possible (it's designated 0-24V, not just 24V as a binary system might be, and "Torque control" is mentioned).
This is not clear.

ABT series data table give coil power from 18 to 50W implying continuous current ~1 to 2 Amps, but peak currents will be higher.
I read the table on page 20 which gives 8A peak, but now I realise that is for the rectifiers, not the brake/clutch.

The datasheet says
ABT series magnetic powder brakes and clutches allow frictionless
and very smooth shift to the required torque levels by the help of the
electronic voltage control. Due to the very low mechanical friction
levels, these are long life and less maintenance needed devices.
On the ABG clutch brake procuct it says:
Nonslip design
Suitable electronic circuit for fast switching and variable
torque levels
Which could imply that varying the DC voltage varies the torque, but it could simply mean that switching a supply voltage controls the state of the device between braking torque and driving torque.
Non-slip seems to contradict variable torque. TO vary torque on a brake or clutch it has to slip.

I'd expect to see some sort of voltage/current to torque characteristics if it can do that.

Application circuits only show switched arrangements. No hint of proportional torque controllers that I can see.

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 2:26 pm

emma1997 wrote:
Wed Aug 12, 2020 1:20 pm
So to cut to the chase all OP needs is a transistor and maybe diode since voltage is so high. Or relay if it is on-off and 'semi-phobia' rears it's ugly head. Should be easy to test from CLI w/o writing any code.

If variable input is needed then certainly PWM will do the job.
You really have no justification for saying that when so little is known about the device.
"Maybe a diode"? why, why not? What rating?
Would a BC107 BJT be a suitable transistor? (NO)
There is a place for naïve experimentation, but it's not on heavy machinery. Do that on a breadboard with an LED.

emma1997
Posts: 929
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 5:03 pm

Actually quite a bit is known about that device, by me personally, having worked with several similar units past few years. Working a lot with CNC clients I've had experience with much bigger assemblies too. 150a and higher no problemo, let alone measly 2a.

As far as dealing with safety issues for noobs, I'll leave that to internet nay-sayers because they do such an excellent job. "Let there be dragons..." lol

I will also agree BC107 is not a good part in this case. Or ANY bipolar for that matter. A cheap MOSFET costing not much more would be a better choice. With proper device selection and programming, no diodes need apply. We can probably skip the series resistor too, specially if this is not for commercial production.

As far as breadboard, if we are talking about the hobby plug-in kind, I will leave that up to those who can afford to chase their tail for hours. As mentioned before I prefer grabbers and solder when results are paramount and there's no time to gamble.

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 5:18 pm

emma1997 wrote:
Wed Aug 12, 2020 5:03 pm
Actually quite a bit is known about that device, by me personally, having worked with several similar units past few years. Working a lot with CNC clients I've had experience with much bigger assemblies too. 150a and higher no problemo, let alone 2a.
So share your experience. Tell us about proportional control of torque using electromagnetic clutches. Provide circuit ideas. Explain the chracteristics.
Try to be constructive rather than sneering at others and making dismissive statements.

pidd
Posts: 947
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 7:15 pm

emma1997 wrote:
Tue Aug 11, 2020 9:04 pm
In most situations there is no 'PWM-based DAC' at all, just the raw PWM signal by itself. Things like motors, lights, etc ignore the fast signal variations and treat it like DC. Even devices rated for DC like meters usually have internal filtering so also accept raw PWM.
No, the assumption has to be that a DC device needs DC unless its known to be ok with PWM/AC

DC filament lamps are not coiled-coils so vibrate with the magnetic field of PWM.

A DC solenoid has inductance which is going to mess up the current/voltage ratio with PWM, its core is not designed for AC so will have eddy currents and heat up with PWM, it will probably vibrate with PWM. There are lots of differences between things designed for DC and AC (in whatever form).

emma1997
Posts: 929
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 9:20 pm

PiGraham wrote:
Wed Aug 12, 2020 5:18 pm
So share your experience. Tell us about proportional control of torque using electromagnetic clutches. Provide circuit ideas. Explain the chracteristics.
Unfortunately between work and home there is little time to bring everybody fully up to speed, however for starters:

viewtopic.php?f=63&t=265855&p=1615752#p1615752

This was in response to a few traditionalists in another thread who insisted diodes are absolutely needed for every relay/solenoid/motor/etc. Turns out not true if you understand the principles and not just design by rote. In fact adding one can cause more trouble than it solves as shown in more than a few white papers..

Our further experiments indicate that extreme EMF spikes can be mitigated not just by fine tuning drive resistance as shown in those scope traces but better handled with PWM (where did I hear that mentioned before?) during startup.

As far as control algorithms I was known locally as 'Mr PID' (at least until pidd came along to confuse things lol). Ironic because I'm also known on some RC forums for skipping that whole mess in favor of modified Kalman, Complementary Filters, but mainly simpler but more effective feedback tuning schemes to control overshoot, speed up settle, etc. Never a big fan of PID, specially the tuning.

Regarding 'sneering and dismissing', reviewing this thread seems to indicate I was more constructive than other posts which seemed only concerned with raining on the PWM parade. Maybe couldn't resist a little in this post now though. lol

pidd wrote:
Wed Aug 12, 2020 7:15 pm
No, the assumption has to be that a DC device needs DC unless its known to be ok with PWM/AC

DC filament lamps are not coiled-coils so vibrate with the magnetic field of PWM.

A DC solenoid has inductance which is going to mess up the current/voltage ratio with PWM, its core is not designed for AC so will have eddy currents and heat up with PWM, it will probably vibrate with PWM. There are lots of differences between things designed for DC and AC (in whatever form).
I prefer not to make such an ASSumption. We will have to agree to disagree on those points.

High frequency AC and DC can be treated very similarly in most cases, specially regarding PWM and it's effect on both inductive and resistive loads. IE modern power supplies which generally don't care whether AC or DC input. Audio too if you understand principles of Class D Amplifier. The speakers may be getting high frequency digital signal but don't treat it as such. Too obvious when it comes to the millions/billions of motors all over the world being speed controlled via PWM.

pidd
Posts: 947
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: controlling 0-24V variable DC voltage with raspberry

Wed Aug 12, 2020 11:46 pm

Class D amps have a low pass filter on the output if they are driving an inductive loads.

You can't just ignore inductance especially as you increase frequency.

emma1997
Posts: 929
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: controlling 0-24V variable DC voltage with raspberry

Thu Aug 13, 2020 1:17 am

pidd wrote:
Wed Aug 12, 2020 11:46 pm
Class D amps have a low pass filter on the output if they are driving an inductive loads.
Not true for the vast majority. Certainly most 3116 which account for 99% of the modules out there connect directly to speakers w/o any output chokes at all. They use the speakers own inductance to take care of HF. Only in the most expensive models for use with certain rare 'troublesome' speakers are the ones mentioned in reference designs really needed. I have one connected to almost every Pi setup in the house to upgrade from those useless tv speakers.

BTW inductive loads are the only ones AFAIK. Piezo and electrostatic are a whole nother ballpark.

In any case OP is free to follow any advice with or w/o regard to source. I have worked with both clutch types. Those with mfg controller to keep high speed rollers from disaster in a PVC food wrap line and bare bones with custom driver in a wire factory to keep spools from tangling. In all cases PWM was the interface. I can't see any application for on-off in these situations where precise feedback and control are required.

Anyone who disagrees with the AC/DC thing is free to use $40 wirewound rheostat or $300 variac to control their motors. I prefer more modern methods with cheap MOSFET or TRIAC and PWM for a fraction of a percent the cost and different realm of efficiency.

pidd
Posts: 947
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: controlling 0-24V variable DC voltage with raspberry

Thu Aug 13, 2020 2:38 am

We are talking about different things here, you are talking about modulated PWM signals, the case in question is providing a (to all intents and purposes) unmodulated PWM signal.

PiGraham
Posts: 4030
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: controlling 0-24V variable DC voltage with raspberry

Thu Aug 13, 2020 8:51 am

pidd wrote:
Thu Aug 13, 2020 2:38 am
We are talking about different things here, you are talking about modulated PWM signals, the case in question is providing a (to all intents and purposes) unmodulated PWM signal.
It's not entirely clear but I think the issue is driving an electromagnet to vary the force between a friction plate a clutch/brake disc.
Although the OP indicated a variable DC voltage 0 - 24V is seems unlikely that is what matters here. No one has provided any info on a controller that takes an analog voltage as input and does something useful with it.

In principle PWM can be used to modulate the excitation of an electromagnet, but it will be the current that matters and the relation of current to force will be highly non-linear (F ∝ i²/g², i=current, g = gap).

What would be useful would be someone able to detail how to relate PWM duty cycle to torque for this device.

markkuk
Posts: 219
Joined: Thu Mar 22, 2018 1:02 pm
Location: Finland

Re: controlling 0-24V variable DC voltage with raspberry

Thu Aug 13, 2020 9:19 am

PiGraham wrote:
Thu Aug 13, 2020 8:51 am

It's not entirely clear but I think the issue is driving an electromagnet to vary the force between a friction plate a clutch/brake disc.
The second post of the OP indicates that the device is a magnetic particle clutch/brake, so no friction plates or discs are involved. The current through the electromagnet adjusts the braking torque (or clutch slip).

Return to “Beginners”