Who is here? 1 guest(s)
 Print Thread
TC4 - Coding and tech issues
greencardigan

Quote

bvwelch wrote:
Hi Brad, there are several options. Which board rev do you have? The simplest option might be to choose a different RTC chip if not too late for your project.

I think I have revision 4.00 but it's not the newer purple ones.

I have a prebuilt serial/i2c LCD driver board that has an onboard RTC so I'd have to find an alternative RTC that is compatible.
 
greencardigan
I've been advised that I'll be unlikely to find another RTC with the same pinout and different or configurable address.

I suspect I will be able to cut the track connecting the two address pins on the MCP3424 and pull one of the pins high or leave it floating?
 
randytsuch

Quote

greencardigan wrote:
I've been advised that I'll be unlikely to find another RTC with the same pinout and different or configurable address.

I suspect I will be able to cut the track connecting the two address pins on the MCP3424 and pull one of the pins high or leave it floating?


I have two MCP3424's in my setup, and it's pretty straightforward to change the address, yes you just have to pull up one of the address pins.
You would also have to go find where the address is defined for the MCP, and change it there too.

Randy
 
greencardigan

Quote

randytsuch wrote:

Quote

greencardigan wrote:
I've been advised that I'll be unlikely to find another RTC with the same pinout and different or configurable address.

I suspect I will be able to cut the track connecting the two address pins on the MCP3424 and pull one of the pins high or leave it floating?


I have two MCP3424's in my setup, and it's pretty straightforward to change the address, yes you just have to pull up one of the address pins.
You would also have to go find where the address is defined for the MCP, and change it there too.

Randy


Did you cut the track between the two address pins on the TC4?
 
randytsuch

Quote

greencardigan wrote:

Quote

randytsuch wrote:

Quote

greencardigan wrote:
I've been advised that I'll be unlikely to find another RTC with the same pinout and different or configurable address.

I suspect I will be able to cut the track connecting the two address pins on the MCP3424 and pull one of the pins high or leave it floating?


I have two MCP3424's in my setup, and it's pretty straightforward to change the address, yes you just have to pull up one of the address pins.
You would also have to go find where the address is defined for the MCP, and change it there too.

Randy


Did you cut the track between the two address pins on the TC4?


Oops, I made a mistake, I was thinking of a something else.

It does look like you could cut the trace, but I'm looking at a picture, so it's kind of hard to see.

At work, for this type of device, sometimes we lift the pin up off the pad, and then connect a wire to the pin. If you use a little heat shrink, it won't short to anything.

Randy
 
greencardigan
Looking at the datasheet it seems to me that I could just cut the track and leave one of the address pins floating. I'll give that a go before I try to solder anything.
 
Bhante
I've finally managed to get Catuai working with full control over my hottop! I had a few stupid errors and could never find the time to go into it properly. No alterations to the hottop required - just a cable from the hottop controller to a breadboard, and the hottop cable from the breadboard to the hottop main board. The signals on this are all 5V logic signals so it's quite straightforward. The output from OT1 has to be inverted, so the negative lead of OT1 goes through 1K resistor to a 74LS04 hex inverter, and the output of that goes directly to the heater pin. Then the positive lead of IO3 goes through a 1K resistor to the fan pin. The other pins are simply shunted together from controller to main board, and the hottop ground is connected directly to the TC4 ground.

It does everything as it should, as far as I can tell (except that the fan does not work well except at around 70% plus - the noises the fan makes at lower speeds suggests I probably have problems with its bearings). Now I can control both fan speed and heater power at will from the two pots on Anlg1 and Anlg2. Everything else is controlled by the hottop controller (even the beeps to put in the beans).

I suppose I could connect the Eject button on the LCD to the Eject pin on the main board - actually I would have to make arrangements in the software for turning on the bean stirrer etc at the same time. It would make a lot of sense to program the TC4 to pull the solenoid, turn off the heater, start the bean stirrer, and set fan to 100% all automatically as soon as the Eject button on the LCD is pressed. It should be a simple matter to override the pots in the software I think?

One could also connect the beans in button to a beans hopper open solenoid - but first I have to make the beans hopper and I can't see myself finding the time to do that any time soon.

Next I need to try to find the time to make a simple little PCB to interface the TC4 to the Hottop to replace the breadboard. It should be possible to replace the hex inverter with a single transistor shouldn't it? What sort of transistor would I need there?

My current TC4 is eventually destined for my espresso machine and the new TC4 I have not assembled yet; I am now wondering if there any simple way of modifying the circuit board so that the output of OT1 would be non-inverting - it would probably be easier with TC4 version 3 than with version 4, because of the reset button.

Bhante
 
Bhante
@Jim: It is like having a brand new roaster - with learning curve to match! I did 2 roasts yesterday - I really see what you mean about the heater being SLOW to respond!!! It reminds me of my hanggliding days many decades ago. With my HotPot gas roaster I have about 7 KW gas to control at the touch of a valve which instantly goes up or down by contrast. Also the fan did not seem to be having the effect I was expecting - I was expecting that it would always have a cooling effect, but in some cases increasing fan speed seemed to increase RoR! Or is that also a delay effect?

Before I was getting a cyclic rise and fall in RoR that I attributed to the heater going on and off, but now I am still getting that with PWM - I think it must be due either to complicated airflow in the roast chamber, or to a regular bean temperature change in different parts of the drum that somehow cycles as the beans get churned. It would be interesting to see whether someone who had modified their drum fins gets the same result.

Can you give me some hints on the fan settings you are using Jim? Maybe you could PM me an output graph or raw data with the control settings shown? I am using 100g of beans at the moment, you are probably using much more. You said before you were using the fan mainly for smoke control, but smoke was strangely absent yesterday relative to the hottop controller.

Bhante
 
JimG
The noise you hear from the fan is not due to bad bearings. Rather, it is the result of the PWM. The noise can be reduced, but not eliminated, with a small cap from the MOSFET gate, or BJT base, to ground. The cap knocks off the square corners of the PWM wave.

I have not found the Hottop fan to have any effect on the roasting profile. I use it only to keep the smoke under control. My normal batch size is 250g, so there is a fair amount of smoke.

I will capture some data for you during my next roast.

Jim
 
JimG

Quote

JimG wrote:I will capture some data for you during my next roast.

Posted here:
http://forum.home...post_29942

Jim
 
Bhante

Quote

JimG wrote:
The noise you hear from the fan is not due to bad bearings. Rather, it is the result of the PWM. The noise can be reduced, but not eliminated, with a small cap from the MOSFET gate, or BJT base, to ground. The cap knocks off the square corners of the PWM wave.

The capacitor is obviously going to have to be immediately before the fan, i.e. on the hottop mainboard istelf? Otherwise its effect would presumably be eliminated by the ULN2003A on the mainboard.

The Hottop mainboard version that I am using has a 0.1uF decoupling capacitor across the fan after the output from the ULN2003A, but I still get the noise despite that. On the other hand the hottop uses PWM on the fan at 67 Hz without generating this grating noise, so presumably the 0.1uF is better suited to the 67 Hz PWM period. Is there a simple way of changing the PWM frequency? Should just be a change to the clock multiplier is it? In the PWM library I assume?

Quote

JimG wrote:
I will capture some data for you during my next roast.

Thanks for the data. I started doing a comparison roast with 250g Yirgacheffe and could immediately see that our roasters are very different! At 100% heater you get more than double the RoR. That in part explains why I was not really getting the roasting profile I was aiming for. Probably I should try and upgrade the heater to the P/B model version. I think the P/B are supposed to have a slightly more powerful heater but I wasn't expecting such a huge difference.

Bhante
 
JimG

Quote

Bhante wrote:The capacitor is obviously going to have to be immediately before the fan, i.e. on the hottop mainboard istelf? Otherwise its effect would presumably be eliminated by the ULN2003A on the mainboard.

Maybe not. As I understand it, the noise is the result of the sudden application of (mechanical) torque by each square PWM pulse. Rounding the corners off of the pulses a little, which a capacitor on the TIP122 base will do, reduces the jolt.

If the noise bothers you (it is a little aggravating, I agree), then I've seen another solution that might be better.

Basically, the alternative circuit uses a filter to integrate the square PWM wave into a smooth DC voltage that varies 0 to 5V corresponding with 0 to 100% duty cycle on IO3.

The DC voltage is amplified to 10.75VDC using an op amp with a voltage divider in a feedback loop.

The amplified (now 0 to 10.75V) signal is connected to the ADJ pin on an LM317 regulator. The fan is then connected to VOUT on the LM317.

Seems like a very clever solution, and is really not much more complicated than what we are using now. I saw this posted on the arduino.cc forum, but I cannot recall the originator who should be given credit.

Quote

Bhante wrote:...On the other hand the hottop uses PWM on the fan at 67 Hz without generating this grating noise, so presumably the 0.1uF is better suited to the 67 Hz PWM period. Is there a simple way of changing the PWM frequency? Should just be a change to the clock multiplier is it? In the PWM library I assume?

Unfortunately, it is not that simple. The PWM on IO3 is provided by 8-bit timer0, which the arduino software also uses for timing functions, delay() and millis(), etc.

The TC4's PWM16 library uses timer1, which is a 16-bit timer and not used by the arduino standard library.

It might be possible to change the PWM frequency on IO3 without messing up the arduino library stuff, but I kind of doubt it.

Quote

Bhante wrote:Thanks for the data. I started doing a comparison roast with 250g Yirgacheffe and could immediately see that our roasters are very different! At 100% heater you get more than double the RoR. That in part explains why I was not really getting the roasting profile I was aiming for. Probably I should try and upgrade the heater to the P/B model version. I think the P/B are supposed to have a slightly more powerful heater but I wasn't expecting such a huge difference.

I have an older Hottop, the D model. So I don't think the performance difference is related to the mainboard. Maybe there is a difference between the Euro and US versions of the machine, though.

Jim

EDIT - Found a link to the LM317 circuit described above:
http://www.rugged.../sch14.png
Edited by JimG on 07/09/2011 9:36 PM
 
Bhante

Quote

JimG wrote:As I understand it, the noise is the result of the sudden application of (mechanical) torque by each square PWM pulse. Rounding the corners off of the pulses a little, which a capacitor on the TIP122 base will do, reduces the jolt.

The grating noise results from the frequency of the PWM, 490 Hz. I've experimented with various frequencies, and 490 was by far the worst of the ones I tried - for both of two different fans, one of which was the Hottop one.

Quote

JimG wrote:Basically, the alternative circuit uses a filter to integrate the square PWM wave into a smooth DC voltage that varies 0 to 5V corresponding with 0 to 100% duty cycle on IO3.

Hmm, I'm not sure that that is a good idea. I thought the whole point of using PWM is that it gives better results than analog voltage especially at low speeds where voltage gives much lower torque on the motor. With PWM you get full power delivered to the motor whenever the signal is on, which is supposed to work better. Apart from that the analog method results in a massive amount of heat being generated - the more heat, the lower the fan setting.

However I followed your link through, and the same site gave another circuit (number 7) which showed how to drive a 12V fan from PWM on a micro. As a result I have now been able to resolve my other fan problem, so thanks for the link!

Quote

JimG wrote:The PWM on IO3 is provided by 8-bit timer0, which the arduino software also uses for timing functions, delay() and millis(), etc.

IO3 is connected to pin 3 on the arduino, therefore it is Timer2. I managed to change the frequency, and results are excellent - the grating noise is 100% eliminated and it sounds identical to when the original hottop connection is used. I am sure it is much better for the fan and for the electronics too. The fan works now right down to 15% - and will run even at 5% as long as it is already turning. However settings below 15 or 20% are not really useful. Putting a filter in the software to make it go to the nearest of zero or 15% might not be a bad idea.

I had great difficulty working out how to do it (in fact my attempts to print out the values on the registers was a failure - the values shown on the LCD don't make any sense).

I had already tested feeding in a frequency of 67 Hz from another microprocessor, and as expected that worked well, since that is what the hottop uses. So I first tried to make a frequency of 61 Hz with the following code:

Quote

// Set PWM mode for Timer 2 (IO3) phase correct, bottom to 127, 61 Hz
TCCR2A = B10100001;
TCCR2B = B00001111;
OCR2A = 127;
OCR2B = 127;

I wasn't sure how to deal with OCR2A and OCR2B so I put the TOP value in both, and one, and the other ... but none of the permutations I could think of worked at all. Finally I gave up tring to fix the frequency accurately and set 30.5 Hz with the following:

Quote

// Set PWM mode for Timer 2 (IO3) phase correct, bottom to MAX, 30 Hz
TCCR2A = B10100001;
TCCR2B = B00000111;

which worked perfectly! Easy when you know how ... just difficult to find out! Sometime when I have time I'll experiment with some fast times, which might give results more generally suitable for a range of different fan types. 31 kHz would be worth trying (prescaler 1).

Quote

JimG wrote:I have an older Hottop, the D model. So I don't think the performance difference is related to the mainboard. Maybe there is a difference between the Euro and US versions of the machine, though.

I know it is possible for the heater to deteriorate (wear out), and there is individual variation between heater elements of identical model and voltage. I have a sneaky feeling I had more power available when it was new, but I didn't have TC4 then so I can't be certain. I'll have to speak to Hottop in Taiwan about it.

Bhante
Edited by Bhante on 07/17/2011 5:08 PM
 
JimG
Thanks for the information about pin 3 and the timer. I did not know that. It may be a good idea to add a class to our PWM16 library to deal with changing the frequency on IO3. I'll look into doing that.

Before your post, I had already breadboarded the alternate circuit that uses the low pass filter, op amp, and LM317T. Turns out it works pretty well.

Heat is only an issue on the 15V regulator. But this is going to exist with either option (I confirmed this with my present circuit which uses a 12V regulator and straight PWM).

The LM317T itself should probably be heatsinked, too, but it did not get beyond "pretty warm" in my tests.

Since I have the breadboard setup done, I will probably go ahead and transfer the circuit to perfboard and try it on the roaster.

Jim
 
Bhante

Quote

JimG wrote:
Thanks for the information about pin 3 and the timer. I did not know that. It may be a good idea to add a class to our PWM16 library to deal with changing the frequency on IO3. I'll look into doing that.

Sounds like a good idea (even though Timer2 is not PWM16!). Each timer output corresponds to a particular pin: OC0A 6, OC0B 5, OC1A 9, OC1B 10, OC2A 11, OC2B 3. It seems that OC2A may not be available when using the TOP feature on OC2B (or the other way around - I'm not clear about this, but it seems one registry entry is used for the other, hence my difficulties programming it).

Quote

JimG wrote:
Heat is only an issue on the 15V regulator. But this is going to exist with either option (I confirmed this with my present circuit which uses a 12V regulator and straight PWM).

Don't forget I am using Hottop's own circuitry to drive the fan, I am only putting a 5V signal that goes on and off on the communication line and letting Hottop do the rest. It could be that the ULN2003 gets warm (I don't usually put my hand in there during a roast), but I would think at low speeds it will generate the least amount of heat since the average current is less. There is nothing on my breadboard between the TC4 and the Hottop generating significant heat.

Bhante
 
Bhante

Quote

Bhante wrote:
The output from OT1 has to be inverted, so the negative lead of OT1 goes through 1K resistor to a 74LS04 hex inverter, and the output of that goes directly to the heater pin. ... It should be possible to replace the hex inverter with a single transistor shouldn't it?

It works OK with the hex inverter (even though the output from the inverter is only just over 3 volts), but I tried to replace it with a transistor - it didn't work at all! I tried using this circuit:

www.kpsec.freeuk.com/images/trinvert.gif
http://www.kpsec....ancirc.htm

Right at the bottom of the page, "A transistor inverter (NOT gate)". I used a BC338, which is a general purpose NPN small signal transistor (same as I used for Q1 and Q2 on the TC4). It wasn't getting switched AT ALL! I tried verious combinations for Rb and Rc: 10K/1K, 47K/4.7K and 100K/10K. Under some conditions the heater was always on and under other conditions always off - but in any case never switched by the logic. Most of the time it was not inverting at all. However the circuit is assuming an input from a device with a high impedance, whereas I have it coming from the transistor Q1. I had a 1K resistor from OT1- to the hex inverter input, and with the transistor inverter I was simply going from OT1- through 1K to Rb. +V and 0V are coming from the TC4.

Do I need to use a PNP instead of the NPN? What about removing Rb and the 1K resistor altogether and connect the base of a PNP directly to OT1-, collector of the PNP to Ground, and emitter through 10K to +V? Would something like that work?

Bhante
 
lmclaren
The circuit you show should work, very standard microcontroller output circuit.

I would start with a 1k resistor for the base and a 10k for the collector.

Make sure the earth (emitter) is common between the controller and the load.

Remember, this circuit will only supply a very low output current, it is realy only a logic inverter, it will however sink a lot more.

I think your problem is more likely to be that the 10k resistor that is supplying the high output is not allowing enough current for the load.

You should be able to replace the output resistor with a 470 ohm if you need.

Do you have anymore details about the hottops drive, circuit maybe? I would be able to give you a more educated guess.

Lee
 
Bhante

Quote

lmclaren wrote:I think your problem is more likely to be that the 10k resistor that is supplying the high output is not allowing enough current for the load.

Lee, the output from the inverter is only a logic signal. It goes into a ULN2003 on the Hottop main board, and the Hottop takes care of the switching. I think my problem is on the other side, the input to the inverter, as the circuit is designed for a high impedance input whereas I have it coming from OT1- on the TC4 - which is the output of an NPN transistor.

Bhante
 
lmclaren
Ahh, I see your problem, the OT1- output is a open collector, it needs a pullup resistor between the OT1- pin and the OT1+ pin, 4k7 is a good start with a 1k before the base of your transistor.

Put 1k in the collector of your transistor and you should be away.
 
lmclaren
btw,

Are both the tc4 and the hottop sharing a common power supply (ground) or isolated so that the -ve can be tied together?

I am guessing that the TC4 is running from a plugpack which will provide isolation, I don't know enough about the Hottop unless you can find me some details.
 
JimG
I think you can get the inverted logic signal you want with nothing more than the pullup that Lee suggested (across OT1+ and OT1-). If I have drawn my sketch correctly, you will get an inverted PWM signal on OT1- directly. As long as you are driving a high impedance input from OT1- you shouldn't need the additional transistor.

Jim
 
JimG

Quote

Bhante wrote:I had already tested feeding in a frequency of 67 Hz from another microprocessor, and as expected that worked well, since that is what the hottop uses. So I first tried to make a frequency of 61 Hz with the following code:

Quote

// Set PWM mode for Timer 2 (IO3) phase correct, bottom to 127, 61 Hz
TCCR2A = B10100001;
TCCR2B = B00001111;
OCR2A = 127;
OCR2B = 127;


I finally got around to looking into this tonight. It turns out that very little additional code is required to manipulate the PWM frequency on timer2.

Here is what I used to get 61 Hz PWM frequency on IO3. Two lines of code is all that it takes:

TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20); // non-inverting fast PWM
TCCR2B = _BV(CS22) | _BV(CS21) | _BV(CS20); // prescaler = 1024 (61.0 Hz)


Supposedly, the change in prescaler for timer2 will not mess with the millis() or delay() functions. I haven't verified this yet.

Jim
 
Bhante

Quote

JimG wrote:If I have drawn my sketch correctly, you will get an inverted PWM signal on OT1- directly. As long as you are driving a high impedance input from OT1- you shouldn't need the additional transistor.

Correct. The output from OT1 is inverted. That is why I need to (re-)invert it. The Hottop needs a non-inverted input.

Bhante
Edited by Bhante on 07/22/2011 6:08 AM
 
Bhante

Quote

lmclaren wrote:
Ahh, I see your problem, the OT1- output is a open collector, it needs a pullup resistor between the OT1- pin and the OT1+ pin, 4k7 is a good start with a 1k before the base of your transistor.

Put 1k in the collector of your transistor and you should be away.

Many thanks Lee. So what you are suggesting is in conjunction with the NPN circuit posted above, not my speculations for a PNP circuit? Maybe multiplying all three resistor values by 10 would also work (then the transistor draws less current)? I'm not using the OT1+ line. If I connect the pullup resistor directly to +V, since I am only dealing with logic signals I shouldn't need the diode D1 that is on the OT1+ line on the TC4 I think?

The Hottop has its own power supply and generates a 5V line on the connector to the PIC controller, and the TC4 is powered from USB. I've shorted the grounds of both. I have just plugged the connector from the Hottop control panel into my breadboard, and have a second cable from the breadboard to the mainboard. Between these two cables most of the signals are shorted across, with exception of the fan and heater lines which are controlled from the breadboard. For the fan all I need is a resistor from the IO3+ line, but since the OT1 switches on the ground side I have to invert it.

Bhante
Edited by Bhante on 07/22/2011 6:47 AM
 
JimG

Quote

Bhante wrote:The output from OT1 is inverted. That is why I need to (re-)invert it. The Hottop needs a non-inverted input.

Oops. Sorry, but I missed that part :|

You might want to consider this instead (using 4N25 optoisolator):

OT1+ --> 470 ohm ---> 4N25.1
4N25.2 ----> OT1-

Hottop +5V ---> 4N25.5
4N25.4 ---> 4.7K ohm pulldown ---> Hottop GND

The non-inverted PWM signal would be on pin 4 of the 4N25 in this arrangement.

Jim
JimG attached the following image:
pwm-out.jpg

Edited by JimG on 07/22/2011 10:43 AM
 
Jump to Forum: