Skywalker roaster... | [389] |
Skywalker, the AL... | [293] |
Skywalker Roasts | [108] |
War on Farmers by... | [63] |
Propane Fluid Bed... | [27] |
Page 1 of 2: 12
|
Artisan Arduino PWM 4-20mA for Power Settings
|
|
exer31337 |
Posted on 01/03/2023 9:23 PM
|
Newbie Posts: 49 Joined: September 12, 2022 |
I am using this sketch. https://gist.gith...behmor-ino I've gotten it talking and the temps reading on Artisan, but the problem is my control is going to be by outputting 4-20mA (minimum 4v DC) to a phase controller (triac). This will be both my loft fan speed and my temp controller on an air roaster (different control circuits of course). From my understanding by running a PWM (on pin 9) I can control the output current (mA) as well as the voltage. 1st: Is the Artisan software and or this sketch set up to run the PWM as a % of output current on pin 9 or is it a more basic PWM of on off cycles to turn a SSR on and off? 2nd: Is there a way to adjust just the current and not the voltage being output by the PWM running on pin 9? If the PWM drops both and has a max output of 20 amps, and a max voltage of 5 amps, I would be at 1/4 minimum voltage when I have enough mA to start controlling the system It would remove all my room for adjustment and only leave me 16-20mA of adjustability. 3rd: If there is no ability to adjust current only, can I use a mosfet transistor to boost the voltage without dropping the amperage? The phase controller can handle a max of 32 Volts DC, meaning I can get a lot more play after the trigger voltage if I boost it with a mosfet so long as the mA don't increase or decrease as well. Looking for input before ordering more parts to make sure I am going the right route. Thank you Edited by renatoa on 01/04/2023 1:35 AM |
|
|
renatoa |
Posted on 01/04/2023 1:48 AM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
1. As is now it is on/off. aka slow PWM in TC4 2. you should use AnalogWrite instead DigitalWrite https://www.ardui...alogwrite/ ... then you can convert that 490 Hz PWM into 4-20mA., using various solutions, as simple, or complicate you want to go. |
|
|
randytsuch |
Posted on 01/04/2023 9:48 AM
|
1/2 Pounder Posts: 395 Joined: June 20, 2009 |
Take a look at this page https://wiki.dfro...DAC_Module Its out of stock at dfrobot, but seems like other places have it. You'd need to have to figure out how to add the code for it to what you have, but my guess is this would be the easiest way to get there. Edited by renatoa on 01/04/2023 10:05 AM |
|
|
renatoa |
Posted on 01/04/2023 10:09 AM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
18-24V DC input could be an unreasonable requirement for some people... What's the problem to generate 20mA from 5V ? Any GPIO pin can deliver this... |
|
|
exer31337 |
Posted on 01/04/2023 10:17 AM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Thank you for all the replies. As to the last, no problem doing it from 5v so long as it stays above 4v and the amperage changes not the voltage... But that is what I don't know how to do. The other option would be to use a 1M or 500k resistor on a 120V 1amp circuit. Looks like it could be possible with an octocupler resistor, but I can't find the right one, unless I am reading the voltage they can handle incorrectly. |
|
|
exer31337 |
Posted on 01/04/2023 10:31 AM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Thank you Randy that is exactly what I was looking for. Going to see if there is an octocupler for 120v 1/4W 500k or 1M that is controllable off the #9 pin as that would be the easiest to program off a basic PWM, but so far the Arduino version Max out at 60v.. another day of google ahead. Not sure if I am reading the octocupler values correctly or not.
Edited by renatoa on 01/04/2023 11:21 AM |
|
|
randytsuch |
Posted on 01/04/2023 10:53 AM
|
1/2 Pounder Posts: 395 Joined: June 20, 2009 |
I don't think PWM is going to work for this, or at least that's not what I would do. You want a precision output of 4 to 20 ma. I expect the current level determines the fan speed and temp output, at least that's what I'm assuming. The normal arduino will just be on or off with a PWM output. That's why I'd go the DAC route, and I'm lazy so I'd buy instead of trying to make this. Some Arduinos have a DAC output, and will generate an analog output. And you can also buy 5V to 4-20ma converters for cheap on ebay and other places, so that's an option too, use the arduino to generate an analog output, convert to 4-20ma, and use that. But I don't know if any arduinos have two DACs. ESP32's have two DACs, but then you're working with a 3.3VDC output, which might work here. |
|
|
renatoa |
Posted on 01/04/2023 11:02 AM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
Yeah, his requirement is min 4V, that's why skipped ESP32 with its DAC outputs as an option. |
|
|
renatoa |
Posted on 01/04/2023 11:21 AM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
Quote exer31337 wrote: Thank you Randy that is exactly what I was looking for. Going to see if there is an octocupler for 120v 1/4W 500k or 1M that is controllable off the #9 pin as that would be the easiest to program off a basic PWM, but so far the Arduino version Max out at 60v.. another day of google ahead. Not sure if I am reading the octocupler values correctly or not. Not sure what you mean here... what Randy proposed is not pwm driven but i2c, a serial bus, and requires some programming added to the application. Intermediate level, not hard core. And I don't see where the octocoupler fits in this scheme... |
|
|
exer31337 |
Posted on 01/04/2023 12:20 PM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Oh, so there are two phase control controller methods I can use. 1st I can do the 4-20mA control. 2nd I can use a 500k or 1M resistor on a 120v 1/4W control circuit. Both will work just as well. I gave up on the resistor approach because all digital resistors I could find were max of 60v, but then I found that some octocupler resistors can go up to 400v so hopefully I can find one that will work at 120v 1/4w. The octocupler just appears to be a much easier approach as it is an led which the Arduino pwm is excellent at controlling. If I can't find the correct octocupler I will go with the DCA. Just figured the simplest solution would be a octocupler resistor it I can find the right one. |
|
|
randytsuch |
Posted on 01/04/2023 12:51 PM
|
1/2 Pounder Posts: 395 Joined: June 20, 2009 |
Quote renatoa wrote: Yeah, his requirement is min 4V, that's why skipped ESP32 with its DAC outputs as an option. Takes another piece, like this one https://www.ebay....3981079175 This says it will take a 3.3V input, and convert to a 4-20ma output. I'm not familiar with the 120V 1/4W control circuit, so don't have anything to say on that. Randy Edited by renatoa on 01/05/2023 2:38 AM |
|
|
exer31337 |
Posted on 01/04/2023 2:38 PM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Randy it is just a 500k ohm potentiometer hooked into the control side of a 120v phase converter. It uses 1/4w of power over the coil so only about .0021 Amps at 120v and the power over the potentiometer would be the same, but it would need to be able to handle 120v. I've seen some digital potentiometers but they are 60v, the only other digital control option I have found for a 120v circuit is an octocoupler, but having a hard time finding the correct voltage while working as a potentiometer vs a transistor. |
|
|
renatoa |
Posted on 01/05/2023 2:42 AM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
Quote exer31337 wrote: Oh, so there are two phase control controller methods I can use. 1st I can do the 4-20mA control. 2nd I can use a 500k or 1M resistor on a 120v 1/4W control circuit. Both will work just as well. I gave up on the resistor approach because all digital resistors I could find were max of 60v, but then I found that some octocupler resistors can go up to 400v so hopefully I can find one that will work at 120v 1/4w. The octocupler just appears to be a much easier approach as it is an led which the Arduino pwm is excellent at controlling. If I can't find the correct octocupler I will go with the DCA. Just figured the simplest solution would be a octocupler resistor it I can find the right one. There is also PWM based control, using the so called DC SSR. With significant more changes there is also skip pulse modulation, used by TC4. Not the last there are digital SCR variators that can be controlled from Arduino using up/down commands. |
|
|
renatoa |
Posted on 01/05/2023 2:44 AM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
Quote randytsuch wrote: Takes another piece, like this one https://www.ebay....3981079175 This says it will take a 3.3V input, and convert to a 4-20ma output. Randy Is viceversa, take current input and outputs voltage. |
|
|
randytsuch |
Posted on 01/05/2023 8:00 AM
|
1/2 Pounder Posts: 395 Joined: June 20, 2009 |
Quote renatoa wrote: Quote randytsuch wrote: Takes another piece, like this one https://www.ebay....3981079175 This says it will take a 3.3V input, and convert to a 4-20ma output. Randy Is viceversa, take current input and outputs voltage. You're right, my bad. This is an example of what is required https://www.ebay....5366517673 I also think it is easier, in the long run, to use something like this and the 4-20ma input. Requires some software work, but they also make i2c adc converters you can connect to the arduino, so use something like my earlier link. Not sure how you would make an opto act like a pot for the high voltage input. Randy Edited by renatoa on 01/05/2023 8:35 AM |
|
|
renatoa |
Posted on 01/05/2023 8:40 AM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
Actually is not necessary to be a pot, but a (high voltage) current source. The RC circuit in the gate of a triac creates the delay required for phase angle control. What I don't understand is why the 4-20 mA requirement for control... A big stock of 4-20 mA triacs ? |
|
|
exer31337 |
Posted on 01/05/2023 10:32 AM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Quote renatoa wrote: Actually is not necessary to be a pot, but a (high voltage) current source. The RC circuit in the gate of a triac creates the delay required for phase angle control. What I don't understand is why the 4-20 mA requirement for control... A big stock of 4-20 mA triacs ? Two different fotek options either a ssr40-va or a 40-la. The va uses resistance and the la used amperage to adjust the phase control. Va potentiometer approach is best because my machine already has this and is already wired for this control. So I know if it will work and should keep working. I am confident the la will work, but the more I change the more room for error. Granted the resolution of the DCA would definitely make this into a more appealing option down the road, but that is a doable upgrade at some point in time. With either the LA or VA I wanted to leave the current high load wire as is and just modify the control. Thanks again for the feedback. |
|
|
renatoa |
Posted on 01/05/2023 12:05 PM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
Why would you need the phase control be implemented inside the SSR, and not externally, for a broader choice? Also, why phase control only ? |
|
|
exer31337 |
Posted on 01/05/2023 12:55 PM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Why would you need the phase control be implemented inside the SSR, and not externally, for a broader choice? Also, why phase control only ?[/quote] Because I am retrofitting a current machine already using those. There are other mods I could make, but from my experience changing 5 different things means if it doesn't work you're stuck fixing 5 things vs one. Doing pid controls is enough of a change I would like to keep the internals as is until I have pid controls the I can start tweaking for better performance. Basically why re-invent the wheel. Edited by exer31337 on 01/07/2023 9:33 PM |
|
|
renatoa |
Posted on 01/05/2023 1:31 PM
|
Administrator Posts: 3188 Joined: September 30, 2016 |
You should start with this |
|
|
randytsuch |
Posted on 01/05/2023 2:13 PM
|
1/2 Pounder Posts: 395 Joined: June 20, 2009 |
Quote Agree, would have helped to know this. You could make a PWM to analog circuit using a low pass filter. Obviously output needs to be high voltage. I'd look at using a motorized pot or similar instead. Change your code and add a DAC, and use the analog out to drive the DAC. Example project https://www.hacks...ter-3240df Edited by renatoa on 01/06/2023 1:58 AM |
|
|
exer31337 |
Posted on 01/05/2023 3:10 PM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Quote randytsuch wrote: Quote Agree, would have helped to know this. You could make a PWM to analog circuit using a low pass filter. Obviously output needs to be high voltage. I'd look at using a motorized pot or similar instead. Change your code and add a DAC, and use the analog out to drive the DAC. Example project https://www.hacks...ter-3240df If I am using a dac couldn't I just get the version that controls the mA 4-20 and then add the LA version of the phase controller? Not a big fan of extra steps. Also instead of building a motorized pot why not just build an led ldr with an ldr that is the correct size? I was just trying to modify as little as possible and not remake the wheel.. that is why I was thinking an OCTA coupler resistor in lieu of a potentiometer, but I was wondering if anyone knew of one that could handle over 120 without needing to make my own. Basically this but cell value 170v https://reverb.co...-switching Edited by renatoa on 01/06/2023 1:59 AM |
|
|
randytsuch |
Posted on 01/06/2023 9:07 AM
|
1/2 Pounder Posts: 395 Joined: June 20, 2009 |
Quote If I am using a dac couldn't I just get the version that controls the mA 4-20 and then add the LA version of the phase controller? Not a big fan of extra steps. Also instead of building a motorized pot why not just build an led ldr with an ldr that is the correct size? I was just trying to modify as little as possible and not remake the wheel.. that is why I was thinking an OCTA coupler resistor in lieu of a potentiometer, but I was wondering if anyone knew of one that could handle over 120 without needing to make my own. Basically this but cell value 170v https://reverb.co...-switching You could use the device from my first link, then you only need one thing, and feed to a 4-20 ma controller. Was just looking at other options in subsequent posts. On LDR's, just not sure what will happen when you feed a PWM signal to an LDR. So give it a shot and see what happens. This would also apply to the opto you linked to, not sure what output you get with a PWM. IMHO, a LED to a LDR has a better chance of working. Think you might need a LPF, but it can be a simple first order one. You could try posting a more generic question on a general electronics forum, or an arduino forum and see what people think. Lot more eyes and brains will see it. But some friendly advice, give lots of information in your first post to help the people reading the question. Randy |
|
|
exer31337 |
Posted on 01/06/2023 11:30 AM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Wasn't clear there, but yes that was the plan, build an led to ldr with the correct cell voltage if I can't find one. I like the one option that regulates mA but then there is more code and a different fotek phase controller vs a normal pwm that controls the LED output strength. |
|
|
exer31337 |
Posted on 01/06/2023 5:55 PM
|
Newbie Posts: 49 Joined: September 12, 2022 |
Thank you Randy and Renatoa. I ended up finding an optocoupler resistor in the correct range but it had a very bad drop off on resistance from 1mA so I ordered the LA version of the phase controller and the current regulator you linked. https://www.ebay....5366517673 I will let you know how it works out. FYI don't buy fotek or any phase controller off of Amazon, once you start reading the reviews they all inform you they're knock offs with fake UL certificates. Edited by renatoa on 01/07/2023 1:31 AM |
|
Jump to Forum: |