topbanner.gif
Login
Username

Password




Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Shoutbox
You must login to post a message.

renatoa
03/25/2024 12:38 PM
coffee drink, Ramper?

allenb
03/24/2024 12:10 PM
Siam3D Welcome

renatoa
03/23/2024 3:02 PM
welcome cup, andrewg

allenb
03/21/2024 5:10 PM
TRH629 Welcome

allenb
03/21/2024 5:08 PM
marimohead Welcome

In Memory Of Ginny
Donations

Latest Donations
dmccallum - 10.00
JackH - 25.00
snwcmpr - 10.00
Anonymous - 2.00
Anonymous - 5.00
Users Online
Guests Online: 7

Members Online: 0

Total Members: 8,165
Newest Member: Ramper

View Thread

Who is here? 1 guest(s)
 Print Thread
Artisan Arduino PWM 4-20mA for Power Settings
exer31337
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
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
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
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
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
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
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
Yeah, his requirement is min 4V, that's why skipped ESP32 with its DAC outputs as an option.
 
renatoa

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... Shock
 
exer31337
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

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
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

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

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

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
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

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
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
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
You should start with this Grin
 
randytsuch

Quote

renatoa wrote:

You should start with this Grin


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

Quote

randytsuch wrote:

Quote

renatoa wrote:

You should start with this Grin


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

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
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
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:

Similar Threads

Thread Forum Replies Last Post
aArtisanQ_PID and Arduino UNO R4 Dataloggers/Controllers/Rate of Rise Meters 2 03/01/2024 12:13 PM
Finally Switching to Artisan Roasterscope Dataloggers/Controllers/Rate of Rise Meters 17 02/28/2024 7:19 AM
Artisan 2 vs Roastime 4 R1 Bullet Roaster 3 01/08/2024 11:53 AM
Renatoa can you walk us through a roast based on Heat power control vs PID? Roasting Coffee 32 08/21/2023 12:41 AM
TC4+ Arduino Uno Issue - no data Dataloggers/Controllers/Rate of Rise Meters 4 08/11/2023 9:16 AM
Homeroasters Association Logo, and all Content, Images, and Icons © 2005-2016 Homeroasters Association - Logos are the property of their respective owners.
Powered by PHP-Fusion Copyright © 2024 PHP-Fusion Inc
Released as free software without warranties under GNU Affero GPL v3
Designed with by NetriX
Hosted by skpacman