Welcome! Log In Create A New Profile

Advanced

Firmware for Techzone Thermocouple A-D converter with OneWire

Posted by brnrd 
Firmware for Techzone Thermocouple A-D converter with OneWire
February 19, 2011 10:53AM
Does anyone have a version of firmware that would allow the Thermocouple A-D converter with OneWire to be used with a Mendel heated bed as described by Adrian in the wiki? Currently the version of the firmware from techzone doesn't include bed temperature control. It's either thermistor or the AD board. I suppose the firmware would be simpler if one uses two AD boards, but it should also be possible to use the AD board for the extruder and a thermistor for the bed.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
February 20, 2011 02:06PM
I just finished making changes to the firmware that comes with the 64-bit 20100719 reprap host to include reading the extruder temperature with the Techzone Thermocouple AD board in combination with the thermistor for the bed. I'll see how it works.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
February 20, 2011 11:26PM
It works! Both thermocouple and the thermistor on the bed were giving the
correct readings. I was also able to regulate the bed temperature as before with
the standard reprap firmware. I haven't built a new hot end with the
thermocouple yet so I just used a heat gun to raise the temperature and I can
see that it turns the heater on when the thermocouple reading is below the
setpoint and then turns it off when it goes above it.

One strange behavior that I noticed is that the M105 command to read the
temperature some times give the wrong number using RepSnapper. Sometimes both
come out zero. Other times, the bed temperature shows up as the extruder
temperature. Perhaps it depends on when the extruder controller receives the
command from the motherboard. It doesn't seem to affect the PID control of the
extruder or the bed. Anyone have any idea on how to fix this?

I'm willing to share and perhaps upload the code to the wiki if there's
interest. I'm not sure if anyone else is using this combination.

Edited 1 time(s). Last edit at 02/20/2011 11:26PM by brnrd.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
February 21, 2011 12:51AM
RepSnapper uses a different temperature reading method than the Host Software. Not sure exactly what that difference is though.


Help improve the RepRap wiki!
Just click "Edit" in the top-right corner of the page and start typing.
Anyone can edit the wiki!
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
February 23, 2011 05:08PM
Please upload it somewhere - I'd like to see how you did it. I'm trying to get the 20110207 firmware to talk to some Max6675 thermocouple chips, no luck yet, but I'm stuck just getting the firmware to talk sanely.

Is that thermocouple board/setup available anywhere, and if so how much? Can you stack multiple thermocouples on the same bus easily? Id like to add a few sensors my Mendel without too much wiring pain...

Wade
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
February 23, 2011 08:05PM
Lambert (Techzone) is setting up a wiki with file section and I told him that I will upload it there. I'm new to this wiki so I don't know how to upload anything.

The thermocouple kit is available from Techzone and it is very cheap. You have to buy the thermocouple separately. Considering how it connects to the digital io of the extruder controller, it's probably possible to add more than one as long as there are pins available. What do you need multiple thermocouples for? Are you working on multiple extruders? thumbs up

Edited 1 time(s). Last edit at 02/23/2011 08:36PM by brnrd.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
February 24, 2011 11:43AM
The DS2670 chip used by Techzone seems to have better specs than the Max6675. Perhaps you should consider using that instead.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 02, 2011 05:04PM
I haven't heard back from Lambert and I've received a couple of requests for the firmware so I'm posting it here. Good luck and let me know how it works or if there are any errors.

I've deleted the attached file due to a dangerous bug! Please read message below with the new firmware code.hot smiley

Edited 1 time(s). Last edit at 03/08/2011 08:37PM by brnrd.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 02, 2011 08:18PM
@Wade

Can u pls let me know if this works with max6675 [www.reprap.org]
I am just curious of my copy-paste & del abilities grinning smiley
Tyvm.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 02, 2011 10:17PM
@noobman - I don't think this one supports that chip. But I think Wade is planning to edit the latest firmware to add support for that one.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 03, 2011 06:27AM
brnrd Wrote:
-------------------------------------------------------
> @noobman - I don't think this one supports that
> chip. But I think Wade is planning to edit the
> latest firmware to add support for that one.

Wade mentioned its max6675 chip not the Onewire.

What i linked has the code for Max6675 in it, but its not tested, though its just copied so i dont see why it shouldnt work unless i made smth wrong. Unlike the last official release which he refers to, this one has a tweak made by someone for the max6675 chip which may work - its mentioned in config.h. That is why i mentioned it, besides the fact i was just curious if it works or not.

And that firmware was started from techzone variant, which was much more clearer and easier to understand. If i would of started from the "official" repository firmware, after a month, i would still be in the phase of cutting out random names, markup language, and #ifndef stuff. Imho, the official firmware is bloated beyond recovery so much, that it hurts my eyes look at it.

Edited 2 time(s). Last edit at 03/03/2011 06:42AM by NoobMan.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 03, 2011 07:10AM
@noobman - Sorry. I missed the link. I thought you were referring to the firmware that I uploaded here. Never mind. smiling smiley

The techzone variant for the OneWire doesn't have support for a heated bed so it's less complicated that the one I edited. I just ignored all the ones that didn't pertain to Gen 3 since I don't have those. In theory, you can add support for the OneWire for all variants of the electronics. It is getting more complicated with every additional support for new electronics. smiling smiley
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 03, 2011 08:52AM
I have no clue about OneWire, but once there is a code that reads it and it works, it should be easy enough to implement.
I took a swift look at what you posted and indeed, omg, that is quite some code there to read it.

Cant say anything except maybe give an ideea, in the extruder class and there are huge lines to delay the read (i guess that is what are for). The link i posted had a similar comment that i was refering to, and used SKIP_COUNT defined in config.h to delay the read, and the code simply starts with incrementing it and only takes the read when its up to the set value.
like starting with:
skipCount++; if (skipCount>SKIP_CLOCK_COUNT) { skipCount=0; } else { [do reading stuff] }

Isnt easier to implement something like that to get a small delay, instead of having a wall of digitalWrite(OWTroubleshoot,1); delayMicroseconds(1); digitalWrite(OWTroubleshoot,bitRead(outNum,4));
etc.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 04, 2011 07:02AM
btw also another issue that i runned into with dual analogRead, was this: in single mode (only one pin used), either of the sensors would work correct, but when trying to run both of them, quite alot of jitter appeared and at least one of the readings is not stable, approx +/-~60mV equivalent of internal noise. Maybe its because some internal adc noise issue with switching back and forth the comparator between the pins or smth like that, cant put my finger on it. Was trying to delay the reads, space them out, have a proper Aref set up, etc, with no success.

Took me quite a while to find the workaround, it seems the fix is using 3 or 4 "fake" analog reads before the actual read that will be used. Just mentioning it maybe it would be of help if you run into same issue.

Also if you can provide a working code for the onewire stuff i can try put it in the ripped firmware there, but i cant test it myself tho.

Edited 1 time(s). Last edit at 03/04/2011 07:04AM by NoobMan.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 04, 2011 07:23AM
Are you using Gen 3 electronics? On the techzone remix, I have seen a similar thing happen when using my modified firmware (the working code for the Onewire is attched in my post on March 2) when I read the temperature with M105. It seems that the tip and bed temperature gets mixed up once in a while. During this, I watched the LEDs next to the power MOSFETS and I didn't see any strange behavior. So, I thought it was just a problem with reading the temperature while the PID control in the extruder controller is still working fine. I decided to just live with it since it won't affect print quality and performance.

I'm still running the "stock" firmware with thermistors on the tip and bed and I haven't noticed this behavior.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 04, 2011 08:13AM
yes i am running the G3 electronics with EC2.2v.

but the issue i think its related to 168 uC and its internal adc, so i dont think it matters what "generation" is being used.

also i think the firmware i linked should work both on ec2.2 and to techzone equivalent, but i cant test it; probably would need re-progam the equivalent motherboard too, or else the master and slave might not be able to talk to each other properly, but without testing it i cant say for sure either.

if your temps are mixed up, i think it could aslo be missing something in the functions, there are more changes needed to add heated bed support, you cant just use the normal readtemp() function or w/e that is there for both temps, or the temps will be mixed, so you need to make another bedtempread() and define it, int it, include it and see how it works in manage() function, etc, include it in the control(), etc

what i linked has a pretty clear structure, try see if you can get it to work with a thermistor and official reprap host (maybe try also with the firmware for the mb1.2), then if it can work out for thechzone and for you, i can try add onewire in it and you can do some tests.

Edited 1 time(s). Last edit at 03/04/2011 08:15AM by NoobMan.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 04, 2011 11:01AM
I'm not sure if I have time to check the firmware that you linked since the one that I modified for the OneWire already works for me. The support for the bed thermistor and heater control was already there in the firmware code from Adrian before I modified it. Once I get another hot end, I'll build one with a thermocouple and start using the modified firmware.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 04, 2011 01:57PM
Oh ok, sry i was under the impression you had some trouble with it still.

Cheers then and Good Luck !
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 05, 2011 06:43AM
I took a look at the code and i cant see bed temp being inside any manage(). I think it just reads the bed but does nothing with it, like the older firmware release, if i am not mistaking. Maybe i am missing something. For EC2.2 firmware at least, the ramps part seems a little more developed but i didnt looked there.

Can i ask if, when bed temp is 0, and you set it to any higher temp, the corresponding bed output led is lighting up?

Edited 1 time(s). Last edit at 03/05/2011 06:56AM by NoobMan.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 05, 2011 07:43AM
As far as I can tell, the 20100719 firmware has PID control of both the tip and bed temperature using thermistors. The same routines are used to read and control the tip and the bed. There's a variable that specifies which one is being read/controlled. So, when I added the code to read the techzone thermocouple A-D with OneWIre instead of the thermistor for the tip, the temperature control still worked.

It seems that the nichrome heater burned out last night in the middle of a 14 hr print. So, I'll switch to a thermocouple when I rewire the tip. Luckily the Mendel kit came with enough wires for two tips. I was hoping to get the parts for another tip before this happened so I can switch to the nophead style resistor block at the same time. Oh well.

Edited 2 time(s). Last edit at 03/05/2011 09:15AM by brnrd.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 08, 2011 08:43PM
brnrd Wrote:
-------------------------------------------------------
> I haven't heard back from Lambert and I've
> received a couple of requests for the firmware so
> I'm posting it here. Good luck and let me know how
> it works or if there are any errors.
>
> I've deleted the attached file due to a dangerous
> bug! Please read message below with the new
> firmware code.hot smiley


Here's the modified code after fixing the bug that can burn up your tip if the reading goes above 255C. I found a dangerous bug in the original Techzone Thermocouple A-D firmware. It reads the temperature into a byte variable causing temperature above 255 to wrap back to 0,1,2,.... This, of course, turns the heater on maximum: always on and the tip burns! I have fixed my modified code and I'm attaching the modified code here.
Attachments:
open | download - FirmwareforOneWireAD_andheatedbed_brnrd.zip (78.2 KB)
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
March 17, 2011 12:45PM
I found that the PID control for the heated bed used in the code doesn't work very well. It never reaches the set point. The PID values being used are the same as the ones used for the extruder tip. I edited the code to use separate values for the heated bed control and then I searched the forum for good settings and found out from Nophead's post that PID is not needed. Bang-bang control is enough. So, I added a call for Bang-bang control. Now, this code allows one to use either PID or Bang-bang on either extruder or bed by changing a function call in extruder_class.pde.
Attachments:
open | download - FirmwareforOneWireAD_heatbed_brnrd 20110317.zip (78.4 KB)
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
April 05, 2011 05:59AM
this is a copy of your firmware using fast writes to replace digitalwrites and a step delay of 2 instead of 5 for pulse delay.

FiveD_GCode_Interpreter.zip

see if you can get it to work. if there are issues with steps let me know. I have not tried this as i don't have time tonight to switch firmware to sanguino, i just know it compiles ok. If it works, then it should allow a 40% increase in speed. all the time saving from i/o changes makes the stepping parts about 20 times faster, but you have math delay, and communication issues still.

there are some other things to try, including fixing the communication issue, math caching, and buffering serial send data.

let me know if this works. baud is still to be run at 19200.

James
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
April 17, 2011 07:30AM
jamesdanielv Wrote:
-------------------------------------------------------
> this is a copy of your firmware using fast writes
> to replace digitalwrites and a step delay of 2
> instead of 5 for pulse delay.
>

Thanks for doing this. I'm not sure when or if I'll get to test this modification for a number of reasons:

1. I have not switched back to using thermistors instead of the Techzone Thermocouple A-D since it seems to take too long to read the temperature leading to a lot of timeout errors when trying to read the temperature. I assume that the EC is taking too long and the MB can't wait for the complete response most of the time.

2. As, you may have pointed out, it seems that the MB firmware version from July 2010 that I modified has some serial communication issues or randomly resets resulting in prints stopping. I'm now using a nightly release from Dec 2010 that has so far been much more stable. The reprap host even runs on both a Mac Pro under Leopard and a MacBook Air under Windows XP (bootcamp). The nice thing is that the EC firmware that I modified is compatible with this MB firmware. So others who want to use the Thermocouple A-D should try this combination. The problem is that you can't find the 20101221 release on the web anymore.

3. Too many other things to do until mid-May. So, my main interest right now is keeping the Mendel in production mode.

4. When I have more development time, I will be installing the RAMPS electronics. If this Gen 3 configuration proves to be reliable, I might use it in a 2nd Mendel.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
April 19, 2011 05:15PM
I read a few days ago about this firmware.
caruKlip - 184 mm/s

[www.youtube.com]
and a clear description here:
[www.thingiverse.com]

any way i hear keeping it in production mode... Man the one thing i hate is messing with something, when it behaves the way it is suppose to.. even though it could be better, it may develop a nasty personality. smiling smiley
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
April 19, 2011 11:13PM
does anyone have 20101221 version?. i can host it.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
April 19, 2011 11:22PM
I have the zip file. It's 82 MB so I can't upload it here.
I would like to have the 20101221 version too. Is there a place where I can get it ? Hotfile maybe?

Love,
RR
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
May 03, 2011 09:40PM
@james or reverend:

Send me your e-mail via PM. Perhaps I can e-mail it to you.
Re: Firmware for Techzone Thermocouple A-D converter with OneWire
May 22, 2011 08:17PM
brnrd, thanks for sharing this. It got me over some last hurdles integrating this into the 20110509 extruder firmware. I'll share as soon as I confirm it's working.
Sorry, only registered users may post in this forum.

Click here to login