Skywalker roaster... | [386] |
Skywalker, the AL... | [279] |
Skywalker Roasts | [105] |
War on Farmers by... | [58] |
Using a TC4 with ... | [41] |
Arduino - TC4+ - SSR issues
|
|
progen |
Posted on 11/14/2022 1:58 PM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
I'm hoping to be able to have my home built fluid bedder PID controller and following a background curve one day but am currently using a pot to the TC4+ - Arduino. It works fine. Artisan shows pot position properly but at 50% physical pot position onwards, it's at full power at the heater and this is reflected on the ammeter. Artisan shows pot input as 50 though but heater is running at max. Where should I start checking? |
|
|
renatoa |
Posted on 11/15/2022 2:40 AM
|
Administrator Posts: 3160 Joined: September 30, 2016 |
Is your pot linear ? If using a logarithmic pot, could exhibit weird behavior, like you describe. How to check this: - look on the pot engraving, for A(lin) or B(log) letter placed somewhere, like the A in the attached image - if no A or B, measure the resistance when cursor is in the middle, if you read aprox equal values, you are good, is linear, if heavily unbalanced, about 1/4 ratio, then it is log. Any custom values for MIN/MAX_OT1 ? ??? |
|
|
progen |
Posted on 11/16/2022 12:17 AM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
Quote renatoa wrote: Is your pot linear ? If using a logarithmic pot, could exhibit weird behavior, like you describe. How to check this: - look on the pot engraving, for A(lin) or B(log) letter placed somewhere, like the A in the attached image - if no A or B, measure the resistance when cursor is in the middle, if you read aprox equal values, you are good, is linear, if heavily unbalanced, about 1/4 ratio, then it is log. Any custom values for MIN/MAX_OT1 ? ??? It's renatoa to the rescue again. ? I forgot about the A and B thing. Didn't think of it since Artisan was showing a linear response to the pot position. It's a B by the way. I suppose I can set maximum power in the sketch or Artisan to around 50 and see whether I can get full travel of the pot. |
|
|
renatoa |
Posted on 11/16/2022 2:03 AM
|
Administrator Posts: 3160 Joined: September 30, 2016 |
You can linearize it a bit, by placing a shunt resistor on the "heavy" side of the pot, as in the attached picture. By heavy I mean the higher resistance half of the pot. Place the cursor in the middle, measure from cursor (middle) to the left/right connections. You should find about 1/5 of the pot value on left half and 4/5 on right half. That is the heavy side where you should place the resistor. If plot the result, will be somewhat like a S shaped line, closer to a straight line than the log graph, with 50% in the middle. ~~~ |
|
|
progen |
Posted on 11/16/2022 11:13 AM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
Thanks again renatoa. Rotary encoders are USD1 - 1.50 in my country Would one of those be better? Edited by progen on 11/16/2022 11:21 AM |
|
|
renatoa |
Posted on 11/16/2022 1:12 PM
|
Administrator Posts: 3160 Joined: September 30, 2016 |
Depends on the scenario you are intending to use them and what rotary thing do you mean... If we are talking about TC4 setup, and you want to use a rotary encoder instead the analogue pot, then you have no support for those kind of digital rotary encoders that sends up/down pulses... I mean those like the middle wheel of a mouse. What you can use in a TC4 a decade switch, combined with a resistor array, to simulate pot fixed positions. Like the attached image. As ergonomy of operation, generally speaking, if the process you are controlling don't offer any kind of feedback of dialed value then a digital input is better than an analogue input method, because dialing a number is always easier and 100% precise, than trying to hunt a pot position. Is the case of the popular SCR power variator that can be found in either pot or digital version on Amazon. But, when you have a feedback of the desired value on a display, as in TC4, then the pot approach becomes valuable when you need faster reaction, for example instant heat cutting, which could be more difficult to do with a 2 digits switch than a pot movement. ~~~ Edited by renatoa on 11/17/2022 1:41 PM |
|
|
progen |
Posted on 11/17/2022 12:50 AM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
Thanks again and again. If only you were in my country. |
|
|
progen |
Posted on 11/18/2022 3:59 AM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
The one I got yesterday was this one. This rotary encoder, is an incremental electro-mechanical device that converts the angular position or motion of a shaft or axle to digital code. The output of incremental encoders provides information about the motion of the shaft, which is typically further processed in processor / controllers into information such as speed, distance, and position. Technical Specifications - Model: KY-040 - Type: Incremental Encoder - Cycles per revolution (CPR): 30 - Working voltage: 0 - 5V - Material: PCB + Brass |
|
|
renatoa |
Posted on 11/18/2022 4:04 AM
|
Administrator Posts: 3160 Joined: September 30, 2016 |
Well, this is what I wrote as lacking support from TC4... as I type Public libraries are available, we can discuss about a custom version to replace analog pots with this encoder, if interested. |
|
|
progen |
Posted on 11/18/2022 4:26 AM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
Quote renatoa wrote: Well, this is what I wrote as lacking support from TC4... as I type Public libraries are available, we can discuss about a custom version to replace analog pots with this encoder, if interested. This was the code supplied by the seller. Can I just copy and paste into the aArtisan sketch? Quote #define SW 5 //define pins and variables #define CLK 6 #define DT 7 int counter = 0; int CLKState; int CLKLastState; void setup() { pinMode (CLK,INPUT); pinMode (DT,INPUT); pinMode (SW,INPUT_PULLUP); Serial.begin (9600); // Reads the initial state of the CLK CLKLastState = digitalRead(CLK); } void loop() { CLKState = digitalRead(CLK); // Reads the "current" state of the CLK // If the previous and the current state of the CLK are different, that means a Pulse has occured if (CLKState != CLKLastState){ // If the DT state is different to the CLK state, that means the encoder is rotating clockwise if (digitalRead(DT) != CLKState) { counter ++; } else { counter --; } Serial.print("Position: "); //one cycle equals to 30 increment Serial.print(counter*(360/30)); //convert the incremental value into degree Serial.println(" deg"); } CLKLastState = CLKState; // Updates the previous state of the CLK with the current state if(digitalRead(SW) == LOW) //reset to 0 deg when the encoder is pressed counter = 0; } |
|
|
renatoa |
Posted on 11/18/2022 6:54 AM
|
Administrator Posts: 3160 Joined: September 30, 2016 |
First you should check the pins 5-6-7 are free, non used... Then... merge this code with actual code, that is not just a copy-paste job... should be synced with actual buttons check... Give me a breath for something more relevant... |
|
|
progen |
Posted on 11/20/2022 12:38 PM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
The encoder should be arriving in a day or two. Do I copy and paste the code into a new text file, give it a name and then include it in the main sketch? I wonder whether anyone knows which pins does the TC4+ uses to communicate with the Arduino. |
|
|
renatoa |
Posted on 11/20/2022 1:52 PM
|
Administrator Posts: 3160 Joined: September 30, 2016 |
Sent the code yesterday, check your inbox here. Quote Do I copy and paste the code into a new text file, give it a name and then include it in the main sketch? Definitely not that simple... For example an Arduino program can't have multiple setup() and loop() functions. The sample code sent by seller have to be merged with existing code of other project. TC4+ communicate via USB, i.e. serial line, having dedicated pins, not interfering with those used by encoder. Seems like 5-6-7 from the sample are unused in TC4. |
|
|
progen |
Posted on 11/20/2022 10:58 PM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
Quote renatoa wrote: Sent the code yesterday, check your inbox here. Definitely not that simple... For example an Arduino program can't have multiple setup() and loop() functions. The sample code sent by seller have to be merged with existing code of other project. TC4+ communicate via USB, i.e. serial line, having dedicated pins, not interfering with those used by encoder. Seems like 5-6-7 from the sample are unused in TC4. The Chinese believe that when a person keeps helping you, that person must have owed you a great deal in a previous life. ? |
|
|
renatoa |
Posted on 11/21/2022 1:07 AM
|
Administrator Posts: 3160 Joined: September 30, 2016 |
Next life probably will be a cat |
|
|
progen |
Posted on 11/21/2022 2:11 AM
|
1/4 Pounder Posts: 84 Joined: December 17, 2019 |
Quote Then it'll be my turn to be the slave again. |
|
Jump to Forum: |