I am currently designing a stand alone arduino board with integrated 5v regulator to be connected to a 9 v battery. The final project will be a reasonably small (hand held box.)
The box itself is connected via a 6 core cable to a motor box with its own motor controler.
The old mechanical controller had a 10k potentiometer and a switch on it. Im my project I am replacing the 10k pot with a digital pot and leaving the switch as it.
I have now concluded that the switch is wired to 240/110v depending on the supply to the motor.
My question is:
Is it feasible to eliminate the battery going to my arduino by utilising the 240/110v MAINS voltage going to the switch? As far as I can tell the circuit could be as small and light as an iphone charging plug. But I am not sure how they keep these so small and light?
I believe that I need to do here is the following:
Mains Voltage > Transformer > Full Bridge Rectifier* > 5v Regulator* > Arduino
(With some capacitors for smoothing)*
What I am not sure is how these small dc circuits handle such a wide voltage range automatically allowing both 240 and 110v input.
All help appreciated.
They are called switching regulators and have few components but are difficult to design correctly for a beginner.
However if you only have two wires to a switch that is not enough to power a supply you need access to live and neutral.
What you are planning to do is potentially dangerous. It's only safe to replace the 10k pot by a digital potentiometer controlled from an Arduino if the motor control circuit is isolated from the mains power to the motor, and both ends of the pot are always within 0 to +5V of ground. This is not necessarily the case. Then potentiometer might even be connected to the live side of the mains.
Do you have any more information about the motor speed controller?
Thanks for your response. I may abandon the idea of eliminating the battery by bringing the 240 v down to 5vdc as this may be too complicated for me.
Moving to the second point about the potentiometer:
Here is a picture of the motor control board Imgur: The magic of the Internet
I have measured the voltage across the 10k potentiometer (this is the yellow grey and red wires connected to the terminal in the top left of the board) this measures a stable 3vdc at all times so I presume the board contains both a power supply area for the motor at 90vdc and a PWM controller at 3vdc.
Should I be isolating this further from the arduino and the digital potentiometer? I have also connected the grounds of arduino to the ground of the Potentiometer as advised previously.
BTW replacing the potentiometer with a digital potentiometer is actually working correctly. Safety is another matter and I would rather add in some more components if they are needed.
That looks promising. It looks like the mains is rectified by the bridge rectifier and large smoothing capacitor to provide DC power to the motor. Mains is also probably passed to the transformer. To the right of the transformer I can see 4 small diodes, and these may be providing power to the electronics.
Disconnect the power and check whether there is continuity between the mains ground connection to the unit (assuming it has a 3-wire mains lead) and the negative end of the 10K potentiometer. If yes, then you could use the digipot.
Alternatively, since it looks like the pot just provides a variable voltage between 0V and +3V to the electronics, you could use 2 opto isolators to convert a PWM signal to an isolated signal in the range 0 to 3V. I suggested a similar arrangement to someone with a similar problem recently, and he reported success using this approach. See Analog switch IC behavior - #48 by dc42 - General Electronics - Arduino Forum and the other posts in the thread.
Either way, you could generate the Arduino 5V from the switched 240V. The simplest approach is to byt a ready-made power supply module, which you can get from Farnell, eBay etc.
Thanks for this info.
The optocoupler approach is not one I have considered but I can see the benefits. I will also look into buying a premade ac transformer as this seems the safest approach.
I cannot seem to find a connection between the mains ground and ANY of the potentiometer pins. I do actually have the digital potentiometer working as intended. Could I ask what the risks may be of using this method?
The rises are that one of the connections of the pot might be at a high potential compared to the arduino ground, or indeed connected to one side of the mains. I would just check the voltage on the pot ends with respect to the arduino ground first before connecting one end to the arduino ground. IF all is well with the other end of the pot when one end is connected to the arduino ground then I would connect the other two terminals. Make all the connections with the power off and measure voltages all over the place before you touch anything.