Who is here? 1 guest(s)
 Print Thread
TC4 with aArtisanQ_PID
brennn
Brad, could you explain how to use the Profile Loader? If I download a profile from the Artisan database: https://docs.goog...nphTzNKWHM, where do I upload it and will the Arduino control the heater and fan speed in order to reach the temperatures in the uploaded profile?
 
greencardigan
The basic procedure for loading profiles onto the TC4 is documented in the first post in this thread.

Essentially the profile is entered into the Profile loader sketch and then loading the sketch onto the Arduino will write the profile to the EEPROM on the TC4.

You need to edit the values in this part of the Profile Loader sketch. The profile is essentially a set of times in seconds and corresponding temperatures. I'm not sure if you will be able to use the Artisan log files.

//////////////////////////////////////////////////////////////////////////////////////////
// PROFILE DATA //////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////


int profile_number = 1;
int profile_type = 1;
char profile_CorF = 'C';
char profile_name[40] = "PROFILE 1";
char profile_description[80] = "Description of Profile 1";
int profile_time[50] = { 0.00,160.00,180.00,200.00,220.00,240.00,400.00,420.00,440.00,460.00,480.00,720.00,960.00, 0};
int profile_temp[50] = {25.00,117.00,127.00,136.00,144.00,151.00,193.00,197.00,201.00,204.00,207.00,232.00,257.00, 0};


If you wanted to upload a second profile, change the profile_number value in the sketch.

I think you also need to update the user.h file for aArtisanQ_PID to inform the TC4 how many profiles you have got loaded on the EEPROM.

Then reload the aArtisanQ_PID sketch. (the profile will then be saved on the TC4's eeprom.

To use the profile you need to activate the PID by sending the PID:ON command or pressing the appropriate button if you have the LCdapter installed. The TC4 will then control the heater. Fan speed will need to be controlled how you usually do.

If you have multiple profiles stored on the eeprom you can select a specific profile using the PID:P1 command(PID;P1 will select profile 1. Use P2 for profile 2 etc).

Hope that makes sense.
 
brennn
^^Fantastic, Brad. Thank you!
 
brennn
I'm trying to better understand the theory behind the code for phase angle control and the integral cycle control. I am fascinated at how jwatte used Bresennham's line algorithm. Can someone explain how this integral cycle control is accomplished? Is it PWM, or no?

And in the following graph, are the values in the middle (i.e; 16667, 14733, 14218) the number of miliseconds in between each outputted signal to the SSR?

#ifdef FREQ60
uint16_t phase_delay[101] = { // 60Hz values based on linearizing power output
   /* 0      1      2      3      4      5      6     7      8       9 */
/* 00 */ 16667, 14733, 14218, 13851, 13554, 13301, 13076, 12874, 12687, 12514,
/* 10 */ 12352, 12198, 12052, 11912, 11778, 11649, 11525, 11404, 11287, 11173,
/* 20 */ 11061, 10953, 10846, 10742, 10640, 10540, 10441, 10343, 10248, 10153,
/* 30 */ 10060,  9967,  9876,  9786,  9696,  9608, 9520,  9432,  9346,  9259,
/* 40 */  9174,  9088,  9004,  8919,  8835,  8751, 8667,  8584,  8500,  8417,
/* 50 */  8333,  8250,  8167,  8083,  8000,  7916, 7832,  7748,  7663,  7578,
/* 60 */  7493,  7407,  7321,  7234,  7147,  7059, 6970,  6881,  6791,  6699,
/* 70 */  6607,  6514,  6419,  6323,  6226,  6127, 6027,  5924,  5820,  5714,
/* 80 */  5605,  5494,  5380,  5263,  5142,  5017, 4888,  4754,  4615,  4469,
/* 90 */  4315,  4153,  3979,  3793,  3590,  3366, 3113,  2816,  2449,  1933,
/* 100 */ 0   
};

Thanks!
 
JimG
Nick -

This post looked really familiar, then I realized it was because you had emailed me this question earlier this week. And I have not replied ;-( Sorry about that.

This table tells the software how many "counts" to wait before turning on the output and firing the triac (e.g. the SSR). The chip's timer is configured for one count = 0.5uS, so 16,667 counts = 8.333ms.

A half cycle of 60Hz AC requires 8.3333 ms, so a count of 16,667 effectively results in the triac waiting for the full half cycle, therefore not firing for that half cycle. IOW, the heater is off for that half cycle.

On the other end is 0 counts, which turns on the triac at the very start of a half cycle, effectively 100% power.

All of the intermediate values are based on the timing needed to delivery a certain percentage of power.

This part of the code is not PWM. It is phase angle control. It is so-named because the delay times result in switching the triac at different phase angles of the AC sine wave.

Jim
 
JimG
The ICC is an entirely different animal. It turns the SSR on or off for an entire half cycle. It decides whether or not a half cycle should be on in essentially the same way that you draw a sloping line with pixels on a computer screen, hence the reference to Bresenham's algorithm.

This is similar, but slightly different, from what is sometimes called burst control. Burst control fires the SSR for X number of consecutive half cycles at the start of a sequence of N half cycles, then turns off the SSR the remaining N - X half cycles.

Burst mode does not deliver the power as evenly as the implementation of ICC in our code. I developed the ICC code specifically to address the problem of flickering lights and surging pumps when pulsing the heater in an espresso machine. But turns out it works well for this application, too.

Jim
 
Titus142
So using Artisan and ArtisianQ_PID_4_3 I ham having trouble controlling the heater with a SSR. At first it would not stay on, just pulse momentarily when I changed the slider or hit a button in Artisan. Then I uploaded the default profile with the profile loader to see if it would make a difference. Now the heater turns on when I turn the fan on. I still have control over the fan, but changing the value of OT1 makes no difference. Fan on=heat on 100%. Any idea what could cause this? Fan is controlled by SSR and ZCD on IO3a
 
JimG
This probably not a very satisfying answer, but here goes anyway ;-)

The predecessor of the aArtisanQ_PID application was a beta release of a program named aArtisanQ:
https://tc4-shiel.../aArtisanQ

For the purposes of troubleshooting the problem you are describing, going back to the base application would remove from consideration any of the more advanced features that were added to the PID version.

A possible course, then, would be to install on your Arduino the base application, and attempt to get correct behavior from event buttons in Artisan that are simple and direct, i.e., set heater to 50%, set heater OFF, set heater to 75%.

This eliminates a whole bunch of things to have to troubleshoot.

Once you can control your heater and fan using the simple event buttons, then add slider control. If this still works, then maybe switch back to the aArtisanQ_PID application?

Jim

Note: the aArtisanQ application is still has the old "pde" suffix and needs to switched over to "ino" suffix. I can do this for you if you need me to.
 
namus80
Hello Everyone I am trying to get the aArtisanQ-PID version 4 on arduino Uno with TC4 shield working with a popcorn popper with a DC fan. I cannot figure out if I need any modifications to the aArtisan PID sketch to change the output to IO3 rather than OT2. Any help would be appreciated. The display currently shows only OT2 on the LCDadapter.
 
Ramezaziz
Hello, I am using a TC4C board with ZCD & Crydom D2425 & D2425-10 to modify and Poppery I to work with aArtisan and I have been using the aArtisanQ_PID sketch, I was able to get the fan to work on the OT2, but the OT1 doesn't control the heater, although I was able to get BT & ET temperature reading from the thermocouples. I followed the same instructions on the following link:

http://www.instru.../?ALLSTEPS


Can someone kindly advise me please?! I am not a computer programmer or an engineer!

I am attaching a copy of the print screen of the error message that I got!

Thanks,

Ramez.
Edited by ginny on 03/22/2015 6:31 PM
 
greencardigan

Quote

namus80 wrote:

Hello Everyone I am trying to get the aArtisanQ-PID version 4 on arduino Uno with TC4 shield working with a popcorn popper with a DC fan. I cannot figure out if I need any modifications to the aArtisan PID sketch to change the output to IO3 rather than OT2. Any help would be appreciated. The display currently shows only OT2 on the LCDadapter.

I believe there would be changes required. aArtisanQ_PID is set up to control a universal motor using phase angle control. IO3 get used to detect the zero-cross pulse from a zero-cross detector circuit. JimG might be able to clarify?
Edited by greencardigan on 03/22/2015 6:07 PM
 
greencardigan

Quote

Ramezaziz wrote:

Hello, I am using a TC4C board with ZCD & Crydom D2425 & D2425-10 to modify and Poppery I to work with aArtisan and I have been using the aArtisanQ_PID sketch, I was able to get the fan to work on the OT2, but the OT1 doesn't control the heater, although I was able to get BT & ET temperature reading from the thermocouples. I followed the same instructions on the following link:

http://www.instructables.com/id/Build-a-Controllable-Coffee-Roaster-from-an-Air-Po/?ALLSTEPS
Can someone kindly advise me please?! I am not a computer programmer or an engineer!

I am attaching a copy of the print screen of the error message that I got!

Thanks,

Ramez.

There is no image attached.

You could try controlling the roaster by sending commands from a serial terminal instead of Artisan. This will confirm if the aArtisanQ_PID code is working correctly.

Try sending OT2;100 to set the fan speed to 100% then OT1;50 to set the heater to 50%. Send READ to get the TC4 to return data.
 
Ramezaziz
Hello & thank you for your quick response!

I have sent the OT2; 100 and the fan worked in full power, then I sent the OT1;50, but the heater didn't go on at all, and finally when I sent the READ to get the TC4C to return data, I got: 64.3,62.56,63.35,0,100

I have been in touch with Jim, he has been a great help, and he actually tried the aArtisanQ_PID on his end, and he still didn't get the OT1 to work with the heater, only the fan worked, but not the heater; he advised me to connect the heater to the OT2 with the fan and it worked with the same SSR Crydom D2425-10. Since he didn't write that sketch he advised me to come here seeking for guidance.

I have tried to download aArtisanQ_PID from Google, but I got an error saying that 'PID' doesn't name a type.

The other sketch that came on the TC4C board pre-loaded works only with the OT2 (Fan), not OT1 (Heater).

The error message that I get from aArtisan is:

Exception:ser.ARDUINOTC4temperature(): list Index out of range @line 25093.

But the temperature is being read from the thermocouples for the BT & ET.

I am not sure if the aArtisanQ_PID code needs a modification?! I would appreciate if someone can send me the modified aArtisanQ_PID Code for aArtisan V. 0.9.2 (1396) at Baud Rate 115,200 to work with the West Bend Poppery I, with the ZCD and SSR Crydom D2425-10 to control the fan & SSR Crydom D2425 to control the heater.

Thanks,

Ramez.
 
greencardigan

Quote

Ramezaziz wrote:

Since he didn't write that sketch he advised me to come here seeking for guidance.


The aArtisanQ_PID code is my mess Shock I'll do my best to help.

You can try my latest working version of my code to see if that helps. I have attached it to this post.

Make sure you modify the user.h file before you upload to your TC4C. You need to comment out the relevant options to make it work properly. For example, if you are not using potentiometers attached to your TC4C then you need to comment out the #define ANALOGUE lines like this //#define ANALOGUE1. And if you are using Artisan, enable the #define ARTISAN and comment out //#ANDROID etc.

You'll also need to check or change some other values in the user.h like the BAUD rate, initial temperature units. There's comments beside most options but let us know if you have questions regarding any of them.
greencardigan attached the following file:
aartisanq_pid_2.zip [24.43kB / 740 Downloads]
 
Ramezaziz
Thank you for your help, I made those changes to user.h file, then when I tried to compile, I got this error message, I just copied & pasted it below, not sure what I did wrong, it sounds like I need to define the PID, not sure how though, please advice. Thanks!

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Uno"
In file included from aArtisanQ_PID.ino:124:
/cmndreader.h:48:20: error: PID_v1.h: No such file or directory
In file included from aArtisanQ_PID.ino:124:
cmndreader.h:110: error: 'PID' does not name a type
aArtisanQ_PID:192: error: 'PID' does not name a type
aArtisanQ_PID.ino: In function 'void updateLCD()':
aArtisanQ_PID:502: error: 'myPID' was not declared in this scope
aArtisanQ_PID:502: error: 'MANUAL' was not declared in this scope
aArtisanQ_PID:674: error: 'myPID' was not declared in this scope
aArtisanQ_PID.ino: In function 'void updateSetpoint()':
aArtisanQ_PID:777: error: 'myPID' was not declared in this scope
aArtisanQ_PID:777: error: 'MANUAL' was not declared in this scope
aArtisanQ_PID.ino: In function 'void checkButtons()':
aArtisanQ_PID:831: error: 'myPID' was not declared in this scope
aArtisanQ_PID:831: error: 'MANUAL' was not declared in this scope
aArtisanQ_PID:832: error: 'AUTOMATIC' was not declared in this scope
aArtisanQ_PID.ino: In function 'void setup()':
aArtisanQ_PID:1004: error: 'myPID' was not declared in this scope
aArtisanQ_PID:1006: error: 'DIRECT' was not declared in this scope
aArtisanQ_PID:1008: error: 'MANUAL' was not declared in this scope
aArtisanQ_PID.ino: In function 'void loop()':
aArtisanQ_PID:1051: error: 'myPID' was not declared in this scope
aArtisanQ_PID:1051: error: 'MANUAL' was not declared in this scope
 
greencardigan
It looks like it can't find the PID_v1 library. Have you got the PID_v1 library in your arduino libraries folder?
 
Ramezaziz
Hello, not sure from where should I get it, when I bought the TC4C broad was pre-uploaded with the aArtisanQ_PID sketch, and sine it is already compiled, I can't download it from the TC4C board, can you please send me missing file to add it to the library. Thanks!
 
greencardigan
I've attached the libraries. Put them in your Arduino/libraries folder.
greencardigan attached the following file:
libraries.zip [44.86kB / 747 Downloads]
 
Ramezaziz
Hello again, I have uninstalled and installed the latest Arduino software and made all the changes and when I compiled, I got this error messages, please advise. Thanks:

Arduino: 1.6.1 (Windows 8.1), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino\libraries\cButton\cButton.cpp:77:9: error: prototype for 'uint8_t cButtonBase::anyPressed()' does not match any in class 'cButtonBase'

uint8_t cButtonBase::anyPressed() {

^

In file included from C:\Program Files (x86)\Arduino\libraries\cButton\cButton.cpp:43:0:

C:\Program Files (x86)\Arduino\libraries\cButton\cButton.h:66:11: error: candidate is: boolean cButtonBase::anyPressed()

boolean anyPressed(); // true if any button is pressed

^

Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
 
greencardigan
Hmm, it seems that Jim recently made changes to the cButton library to make it compatible with Arduino 1.60. Possibly the libraries I gave you (from the aArtisan folder on the TC4 code repository) did not have this update. Try replacing the cButton library folder with the updated folder I have attached.

See how that goes.
greencardigan attached the following file:
cbutton.zip [4.06kB / 773 Downloads]
 
Ramezaziz
I have replaced it, but I am getting the following error

Please see the attached zip file below

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Admin edit: reduced to a zip file:
Ramezaziz attached the following file:
results.zip [1.02kB / 702 Downloads]

Edited by JackH on 03/26/2015 8:19 PM
 
Ramezaziz
If I downgrade my Arduino will that solve the problem? If that is the case, which version will work with it? I am using now V1.6.1

Thanks!
 
greencardigan
I don't think that is the problem.

Do you have your aArtisanQ_PID folder inside the libraries folder? Try moving it outside the libraries folder.

It looks like it's finding multiple copies of the command reader and phase control files.


If this doesn't work I can try sending you the library files I am using. I can do that later when I get home.
 
Ramezaziz
I was able to compile it after I removed the aArtisanQ_PID folder out of the libraries folder but I got this message, should I upload it on the TC4C board, I am afraid to lose what was uploaded on my board, please advise:

ketch uses 25,506 bytes (79%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,893 bytes (92%) of dynamic memory, leaving 155 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.
 
Ramezaziz
Hello & thanks for your help. I was able to upload the sketch successfully, and when I tested it using the Arduino software by typing OT2;100 & OT1;50 the fan & the heater worked fine, but when I tried to use it with the Artisan software, the fan just makes a zzzzzzz sound, but doesn't move, not sure is it because the memory is low or there should be a setup in the Artisan software or the sketch is not compatible with the Artisan version that I am using V0.9.2, I am not sure. Please advise!
 
Jump to Forum: