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
TC4 - Coding and tech issues
philipm
Thanks again Jim.
 
greencardigan
Jim or anyone else,

Can you tell me if the TC4 fits onto the Arduino mega r2?

I'm very close to abandoning the picaxe system I currently use and picking a few Arduina Mega boards.

Also could the TC4 interface with the Arduino nano?

Cheers,
Brad
 
JimG
Hi, Brad -

A quick look at the schematic shows that the TWI (or I2C) signals are on different pins. The TC4 expects TWI on the A4 and A5 pins per the Uno pin mapping. On the Mega, the upper left header was expanded from 8 to 10 pins, with the extra 2 pins dedicated to TWI.

I think that the processors' timers are mapped to different pins as well, but haven't researched this fully. If this is true, then TC4 software that uses PWM will have issues.

It would probably be easier to make the Nano work since the pin mappings are all the same. Obviously you'd have to connect everything with fly wires, but I'm pretty sure it would all work.

Jim
 
greencardigan

Quote

JimG wrote:
A quick look at the schematic shows that the TWI (or I2C) signals are on different pins. The TC4 expects TWI on the A4 and A5 pins per the Uno pin mapping. On the Mega, the upper left header was expanded from 8 to 10 pins, with the extra 2 pins dedicated to TWI.

Hi Jim,

I just ordered another TC4 board. I understand I could still use it with a mega board if I don't stack them together?
 
JimG

Quote

greencardigan wrote:
I just ordered another TC4 board. I understand I could still use it with a mega board if I don't stack them together?

Yes, I believe so. The PWM pins on the mega, however, may be different than the 328, though. So the PWM output functions provided by the PWM16 library might require a bit of tweaking.

Jim
 
Bhante

Quote

greencardigan wrote:

I just ordered another TC4 board. I understand I could still use it with a mega board if I don't stack them together?


Just a thought - for those pins that are incompatible between the Uno and Mega boards, you could remove the headers/sockets and connect the offending pins by flywires. Or better still - leave the headers intact, and cut the tracks on either Mega or TC4 to re-route using flywires. Then the rest of the pins will connect normally.

Bhante
 
greencardigan
Yes that always an option. I have a Uno coming in the mail so I'll try that first.

I was just wondering if I'll run out of memory on the 328. I think I recal Randy having memory issues at one stage.
 
greencardigan
I have the TC4 + LCDapter hooked up to an Arduino Nano and it's working fine.

Jim, do the TC4 boards ship with the thermocouple data in the EEPROM? How can I tell if it's being used? And is there much space left on the EEPROM?
 
JimG

Quote

greencardigan wrote:
Jim, do the TC4 boards ship with the thermocouple data in the EEPROM? How can I tell if it's being used? And is there much space left on the EEPROM?


The TC4 boards are shipped with a short header (1K is reserved, but much less is used) in the EEPROM that contains board identification info and a few bits of calibration data.

The calibration data consists of scale and offset adjustments (typically 1.003 and 0) for the ADC, and offsets for thermocouple readings for K and T (typically around -0.25C). The boards will work just fine without these minor adjustments, but I preload some "close" values in the EEPROM's during testing of the boards.

The EEPROM is 24LC512, which is 64K x 8 bit. So there is quite a bit of usable space beyond the reserved first 1K.

Jim
 
greencardigan
Thanks Jim, I have since found the readcal and writecal sketches.

I have the aBourbon and aArtisan sketches compiling and uploading ok but am having trouble with aArtisanQ and aCatuaiQ. Maybe I'm doing something wrong as I'm quite new to the Arduino.

I get the following errors when trying to compile aArtisanQ. Is this something to do with Arduino 1.0 compatibility??



In file included from phase_ctrl.cpp:44:
phase_ctrl.h:72: error: variable or field 'output_level_icc' declared void
phase_ctrl.h:72: error: 'uint8_t' was not declared in this scope
phase_ctrl.h:73: error: variable or field 'output_level_pac' declared void
phase_ctrl.h:73: error: 'uint8_t' was not declared in this scope
phase_ctrl.h:84: error: 'boolean' does not name a type
phase_ctrl.cpp:48: error: 'uint8_t' does not name a type
phase_ctrl.cpp:51: error: 'int8_t' does not name a type
phase_ctrl.cpp:52: error: 'boolean' does not name a type
phase_ctrl.cpp:53: error: 'int8_t' does not name a type
phase_ctrl.cpp:54: error: 'uint32_t' does not name a type
phase_ctrl.cpp:55: error: 'boolean' does not name a type
phase_ctrl.cpp:61: error: 'uint16_t' does not name a type
phase_ctrl.cpp: In function 'void setupTimer1()':
phase_ctrl.cpp:94: error: 'TIMSK1' was not declared in this scope
phase_ctrl.cpp:95: error: 'TCCR1A' was not declared in this scope
phase_ctrl.cpp:96: error: 'TCCR1B' was not declared in this scope
phase_ctrl.cpp:96: error: '_BV' was not declared in this scope
phase_ctrl.cpp:97: error: 'OCR1A' was not declared in this scope
phase_ctrl.cpp:99: error: 'TCNT1' was not declared in this scope
phase_ctrl.cpp: In function 'void ISR_ZCD()':
phase_ctrl.cpp:104: error: 'TCNT1' was not declared in this scope
phase_ctrl.cpp:106: error: 'lastCross' was not declared in this scope
phase_ctrl.cpp:106: error: 'millis' was not declared in this scope
phase_ctrl.cpp:109: error: 'outputEnable' was not declared in this scope
phase_ctrl.cpp:110: error: 'LOW' was not declared in this scope
phase_ctrl.cpp:110: error: 'digitalWrite' was not declared in this scope
phase_ctrl.cpp:112: error: 'OCR1A' was not declared in this scope
phase_ctrl.cpp:112: error: 'phase_delay' was not declared in this scope
phase_ctrl.cpp:112: error: 'pac_output' was not declared in this scope
phase_ctrl.cpp:112: error: 'uint16_t' was not declared in this scope
phase_ctrl.cpp:116: error: 'newN' was not declared in this scope
phase_ctrl.cpp:118: error: 'curr' was not declared in this scope
phase_ctrl.cpp:118: error: 'ratioN' was not declared in this scope
phase_ctrl.cpp:118: error: 'int16_t' was not declared in this scope
phase_ctrl.cpp:118: error: 'int16_t' was not declared in this scope
phase_ctrl.cpp:118: error: declaration of '<typeprefixerror>int16_t'
phase_ctrl.cpp:118: error: conflicts with previous declaration '<typeprefixerror>int16_t'
phase_ctrl.cpp:118: error: 'int8_t' was not declared in this scope
phase_ctrl.cpp:121: error: 'curr' was not declared in this scope
phase_ctrl.cpp:121: error: 'ratioN' was not declared in this scope
phase_ctrl.cpp:124: error: 'outputEnable' was not declared in this scope
phase_ctrl.cpp:125: error: 'HIGH' was not declared in this scope
phase_ctrl.cpp:125: error: 'digitalWrite' was not declared in this scope
phase_ctrl.cpp:128: error: 'LOW' was not declared in this scope
phase_ctrl.cpp:128: error: 'digitalWrite' was not declared in this scope
phase_ctrl.cpp: At global scope:
phase_ctrl.cpp:133: error: expected constructor, destructor, or type conversion before '(' token

 
greencardigan
OK I see it compiles ok in Arduino 0023.

I assume it's ok to upload aArtisanQ with the older Arduino software?
 
greencardigan
OK I've found your Arduino 1.00 version of aArtisanQ.
 
greencardigan
Jim,

I've added analogue control to aArtisan.

It still allows control of OT1 and OT2 from Artisan but also allows potentiometers connected to ANLG1 and ANLG2 to control the output level.

I think this is a worthwhile addition to aArtisan but let me know what you think.

Brad
greencardigan attached the following file:
aartisan_analogue.zip [11.25kB / 652 Downloads]
 
JimG
Great idea!

I will give a try and then post it as a download on the project googlecode site. Thanks.

Jim
 
greencardigan
And here's the same changes to aArtisanQ.

I can't test this one properly as I haven't got my ZCD detector working yet. But inputing a 50Hz square wave into IO3 seems to get it going.
greencardigan attached the following file:
aartisanq_analogue.zip [17.51kB / 591 Downloads]
 
greencardigan
I have added the Arduino PID library to my version of aArtisanQ and from my preliminary testing (still on the breadboard) it seems to be functioning ok.

So I'm wondering where to go next. I think there's a few options.

1. Roast profiles stored on the TC4 EEPROM. The desired profile could be selected using the LCDAPTER buttons or custom commands from Artisan or RoastLogger. Not sure if RoastLogger can send customized commands like Artisan can?

2. The PID code controlling the RoR and Artisan or RoastLogger sending RoR setpoint commands at appropriate times (either custom event buttons in Artisan or automatic events in RoastLogger?)

Any thoughts??
 
bvwelch
Which Arduino - which cpu, how much flash and ram are required for your version of aArtisanQ? thanks.
 
greencardigan
Uno and nano 328.

I can't remember off the top of my head how much of the memory is being used. Around 22K I think.

CPU? in my laptop? I'm using a 3rd gen i7 in a mac book pro.
 
JimG

Quote

greencardigan wrote:So I'm wondering where to go next. I think there's a few options.

1. Roast profiles stored on the TC4 EEPROM. The desired profile could be selected using the LCDAPTER buttons or custom commands from Artisan or RoastLogger. Not sure if RoastLogger can send customized commands like Artisan can?

I think that's the right direction, i.e., storing profile information in the EEPROM. Let's keep away from the first 1K of the EEPROM and reserve that space for calibration and other system data if possible.

Artisan should be able to support this without any modification to the Artisan code through its custom event button feature. But RoastLogger would require modification if Tom decided to support this feature. It currently does not allow the user to define/send custom commands.

Quote

greencardigan wrote:2. The PID code controlling the RoR and Artisan or RoastLogger sending RoR setpoint commands at appropriate times (either custom event buttons in Artisan or automatic events in RoastLogger?)

Yes, although without testing I can't say whether or not I believe RoR can be successfully used as the process variable on all roasters. For instance, I do not believe this would work on a Hottop drum roaster. So in addition to RoR as the PV, the system should probably be set up to use ET or BT as the PV as well.

When I start thinking about PID tuning (autotuning?), inputting/storing profiles, etc. my head starts to spin! A great deal of coding would be required for a general purpose approach.

The Kona package may already do many of these things, BTW?

Jim
 
greencardigan
Yes I believe Randy ended up using the same PID library. However kona isn't based on aArtisan. To me it seems logical to build on aArtisan and keep all its functionality. I'd like to have the PID functionality optional with it activated by defining it in user.h.

Is Kona still being developed/enhanced?
 
JimG

Quote

greencardigan wrote:Is Kona still being developed/enhanced?


It has been inactive for quite a long time. I don't know if Randy has any plans for further development.

Jim
 
greencardigan

Quote

JimG wrote:

While you are evaluating software, I suggest you also take a look at RoastLogger. Tom (aka greenbean on TooMuchCoffee.com) and I have been conspiring over the past several months to make RoastLogger and the TC4 system get along very well.

In addition to convenient slider controls for manual control of the roaster, Tom has also created an interface that optionally allows RoastLogger to take automatic actions (fan and heater control) when certain roast events have been detected. Once these roast event points have been set by the user, RoastLogger does a very nice job of automating roasts.

Jim


Jim do you still have contact with the Artisan folk?

I'd like the 'Alarm' functionality in Artisan to be able to send serial commands. That would give us automatic actions like you have in RoastLogger I think?

It would also be nice if the standard buttons in Artisan could be programmed to send serial commands in addition to their normal function. Like the 'charge' button sending a command to turn the heater on or the 'drop' button turning the heater off.

Also I've got my PID version of aArtisanQ to a point where it's usable I think (still on a breadboard though). I'll post it here when I get a chance tomorrow. It's taken me a bit to work out c++ but I'm getting there.
 
greencardigan
Here's my attempt at modifying aArtisanQ.

There are two main changes compared to aArtisanQ:
- addition of analogue input support (like aCautai) to control OT1 and OT2
- PID control of OT1 using time/temp profiles stored in EEPROM. Requires PID_v1 library.

More detailed changes (my change log).

- Added code to read profile from EEPROM and interpolate to calculate setpoint. Uses Time/Temp profiles.
- Added code to end PID control when end of profile is reached
- Added additional PID command allowing roast profile to be selected
- Added additional PID command allowing PID tunings to be adjusted on the fly (required MAX_TOKENS 5 in cmndproc.h library)
- Added PID command allowing PID control to be activated and deactivated from Artisan
- Added roast clock. Can be reset with PID;TIME command
- Removed LCD ambient temp display and added roast clock display (required control of main loop to run at 1 second loops)
- Added code for analogue inputs

So a typical procedure to use the PID control would be.

1. Load Profile_Loader_1.ino onto the arduino to store a profile into the TC4 EEPROM. Then load aArtisanQ_PID.ino. This step is only required on the first run.

2. Connect to computer and run Artisan software.

3. Send a PID;P1 command from a custom button to select profile 1 from the EEPROM.

4. Send a PID;ON command from a custom button to turn the PID control on. Or PID;OFF to deactivate.


Any thoughts? Am I wasting my time? I think my changes could easily be copied back into the non phase control/icc version of aArtisan.
 
JimG

Quote

greencardigan wrote:
Any thoughts? Am I wasting my time? I think my changes could easily be copied back into the non phase control/icc version of aArtisan.


My thoughts are that this is fantastic!

A few questions:

1) How does the user select which temperature channel (i.e. BT or ET) to use as the PID process variable?

2) While the PID function has control of the heater, does the heater control potentiometer become inoperable?

3) Does the potentiometer for the fan continue to work during PID control?

In reply to your previous post about making changes to Artisan, I cannot say whether or not the authors will be receptive to adding these capabilities. My suggestion, if it makes sense to you, would be to establish a user base for these new improvements to aArtisan and proceed then?

Jim
 
greencardigan

Quote

JimG wrote:

A few questions:

1) How does the user select which temperature channel (i.e. BT or ET) to use as the PID process variable?


At the moment it's set to channel 1 but could easily be changed so the channel is set in user.h. I haven't had a chance to get my head around how the chan command fits in with this yet.


Quote

2) While the PID function has control of the heater, does the heater control potentiometer become inoperable?


Sort of. At the moment the pot is still being read during PID control but then the PID overrides the pot value. I should probably stop the POT being read while the PID is active.

I've essentially used the same potentiometer code that you had in Cataui. So only when the POT value changes does the output get updated. If the PID is turned off, the output stays at the last set PID output until the POT is adjusted.


Quote

3) Does the potentiometer for the fan continue to work during PID control?


Yes I think so. The OT2 potentiometer and Artisan commands for OT2 should keep working as normal. I just got my random cross SSR in the mail yesterday. So once your ZCD board arrives I'll start putting the bits into a box so I can do some real testing.

Some other things I like added or fixed.

- RoR calcs and display. I think this is needed so it can be run better stand alone without the Artisan software.

- Support for the LCDapter buttons and LEDs. Also to allow it to be run without the Artisan software.

- I haven't worked out what happens if the units are changed from C to F or vice-versa during a PID controlled roast.
 
Jump to Forum:

Similar Threads

Thread Forum Replies Last Post
New TC4+ Popcorn Pumper issues Building a Coffee Roaster 19 04/24/2023 9:30 AM
Arduino - TC4+ - SSR issues Dataloggers/Controllers/Rate of Rise Meters 16 11/21/2022 2:11 AM
Heating Issues with Nesco Pro Other Roasters 4 04/22/2021 1:51 PM
Repeatability Issues Due to Chaff Combustion During Roasting?? HotTop Roaster 5 01/01/2019 2:14 AM
TC4/Artisan Temp Read Issues Dataloggers/Controllers/Rate of Rise Meters 16 01/04/2018 12:03 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