Control motor with Arduino via "isolated 0-5 V DC signal"

Hello everyone

I have a little question about controlling an external speed controller with an Arduino. Its manual describes:

Connect a 10K Ohm potentiometer to terminals “S1”, “S2”, and “S3”. Alternatively, an isolated 0–5 VDC signal may be connected to “S2” using “S1” as common.

Could this be an easy task for an Analog Out of Arduino? Since it is PWM, does it need a low pass filter as stated here? The corresponding schematic looks rather complicated (see here).

Or should rather a digital potentiometer be used? Could a circuit like this one be used and instead of the LED, just connect S2 and S1? Or would additional "isolation" have to be used?

Thanks for some general guidance on this project!

Does anyone have a hint for me? Is this what I need?: |500x187

And just connect all GND's to S1 ("common") and the 0-5V to S2? I'm not sure where I would take the +7-24VDC since my motor driver does not havy any DC power source:

Would I just add a small PSU to 230V to supply this isolation-circuit? Would this PSU not kill the whole isolation circuit? Thanks for the help!

As there has not been a rush to respond I will throw in my very non-expert 3 cents. I would use a digital potentiometer simply because my knowledge of electronics is not sufficient to design a circuit to smooth the PWM output from analogWrite()

...R

I’m joining the ranks of the non-experts in responding to this.

I believe that the definition of “isolated” here means isolated from the mains supply eg you are not creating the control voltage from a potential divider across a mains supply, or that the 5 volts is somehow derived from a transformerless power supply.

Your whole arduino system, assuming it is powered via a battery or conventional transformer based power supply, could be regarded as “isolated” for this purpose, especially if it is in a nice plastic box and you don’t use the usb connection when the system is connected.

From the Bodine manual:

CAUTION–The control board signal common is not at ground potential. Any external signal or equipment connected to the control must be electrically isolated from ground.

Which means your later statement:

And just connect all GND's to S1 ("common") and the 0-5V to S2?

Is a big no-no. The opto isolated circuit you posted looks okay but it must be powered from a separate, isolated from ground source. A small 10va 12vac power transformer into a diode bridge with a filter cap is okay. A decent quality 12vdc wall wort is fine as well. Don't go past 12 volts into that circuit, 24v is totally unnecessary and does nothing but put extra heat load on the 78L05.

At no point can any of the common 'ground' connections between the power supply and everything to the right of the transistor in the optocoupler in the isolator circuit come into contact with the Arduino ground, it's power supply or USB connections.

Even if you power your Arduino with a battery and you don't use that isolation circuit, you could find the ground pin of your Arduino floating at 150 volts dc or something equally nasty. Without a schematic of the Bodine drive, it's hard to say what the voltage could be but it's enough to know it presents a danger and that's why Bodine has the big caution note.

Thanks for the replies!
6v6gt: I think I’m still missing something… The GNDs to the right side of the OP can all be connected together, is that right? Does the attached corrected schematic look ok?
Could the Arduino PWM output be a problem for the motor controller since it is not really 0-5V, but 0 or 5V?

I stepped across a similar project here today:

This would leave me also with the digital pot version if I’m right? Just that this link does not explain how this digital pot is supplied with operating voltage - seems to come from the 3 terminals which connects it to the motor control…?

Thanks again!

As I said, I am no expert. However

The diagram in the OP for the isolated 5volt supply came from here: https://hackaday.io/project/15706/gallery#dfb27f7ac18af8dfb7cb030b90b16ca2

All the grounds on the high voltage side of the opto-isolator are connected together and to the s1 (common) on the motor controller. The output marked 0-5v goes to S2 on the motor board.

I'd be tempted to look for a +5v on the motor board. If you are lucky, you avoid having another power supply and regulator etc. for the isolated analog output circuit you are adding, but here you have to know what you are doing.

The diagram from https://electronics.stackexchange.com/questions/138980/controlling-a-12v-potentiometer-with-arduino which you have shown is a replacement for the mechanical potentiometer in that specific motor controller, where it is known that the potentiometer there is simply a voltage divider across a 12 volt source. You don't have enough information to use that for the across the potentiometer connections of your motor board unless you find a circuit diagram. You may, however, be able to use something similar to produce the isolated 0-5 volts instead of the "hackaday" circuit.

I think I'm still missing something... The GNDs to the right side of the OP can all be connected together, is that right? Does the attached corrected schematic look ok?

Schematic is correct with the exception that you missed the ground on the opto transistor emitter. Connect that to the other gnd points as you've done and you're good to go.

Could the Arduino PWM output be a problem for the motor controller since it is not really 0-5V, but 0 or 5V?

No, because the circuit from Hackaday converts PWM to a 0 to 5 volt analog value. It also provides the required isolation. Without the isolation, you'll probably blow up your Arduino and the USB port in your computer since the Bodine drive interface floats above ground by an unknown voltage level. Without isolation, you'd create what's called a ground loop which results in undesirable and sometimes uncontrollable currents flowing in circuits where it should not.

I don't think that cd4049 circuit will give you clean dc output, it's a function of the input impedance of the drive which is unknown.

A digital pot will cause a ground loop between the Arduino and the drive. You could use one but you'd need an I2C isolator like the ADM1250

6v6gt said:

I'd be tempted to look for a +5v on the motor board. If you are lucky, you avoid having another power supply and regulator etc. for the isolated analog output circuit you are adding, but here you have to know what you are doing.

That's tempting but it wouldn't work without redesigning the circuit using using rail to rail op amps. The schematic you drew in post #5 will a-okay with the 12 volt supply shown, you just need to connect the emitter of the opto as previously mentioned.

I was curious to see how the hackaday circuit would perform with from a 5 volt supply if i used an MCP6002 rail to rail op amp (pin compatible with a LM358). I also used a 4N35 opto-coupler which I had in my odd parts box instead of the 6N136. I got an output range within about 150 mV short of the rails.

The circuit is actually described as a non inverting unity gain amplifier coupled with a 2 pole Butterworth low pass filter. At least, that is how I interpret it: http://www.radio-electronics.com/info/circuits/opamp_low_pass_filter/op_amp_lowpassfilter.php http://www.learningaboutelectronics.com/Articles/Unity-gain-buffer

The circuit works in such a way that if the connection to the optocoupler led fails (the Arduino crashes, restarts etc.) the maximum voltage (ie 5 volts) appears on output. It is not clear from the information supplied if that means the motor runs at maximum speed or if it stops. Probably, if it means the motor runs at maximum speed, the circuit should be changed.

Edit 1 I also inverted the input into the buffer op amp with a PNP transistor so that if there is no power to the opto-coupler led, the output voltage is 0. I got within a couple of millivolts of the rails. See https://forum.arduino.cc/index.php?topic=636012.msg4308234#msg4308234

Hey guys

Thanks a lot for your help! I bought the components and finally built the circuit this weekend: It works :-)

@6v6gt: I found a "7805CT" on the motor control board for 5V and was able to use it (it has the same common as "S1" of the motor control board). Thanks for the hint. So I saved the 12V PSU and the "LM78L05" on my own circuit.

Cheers!

It's good that it all worked out. If the Arduino is switched off (ie there is no power to the LED in the optocoupler), what state is the motor in ? Stopped or running ? I had to invert the output of the optocoupler in my quick lash-up to get 0 volts instead of 5 volts when when the Arduino side was switched off.