Relative Newbie: Extend functionality of electric smoker - Page 1
Forum section: electronics / general

author: NegativeTen
author_rank: Contributor
timestamp: June 02, 2015, 02:10:08 am
content: Hey folks, greetings from Arkansas! I'm a seasoned follower of the YouTube channel, new member to the forum, and relatively new in the hardware/EE world. I'm a software developer by day, and attempting to become an electronics hobbyist by night.The problem at hand:I've got a Masterbuilt Electric Smoker that I use quite often. It's a great unit and produces some tasty eats, but it has a couple drawbacks.The 7 segment display is a bear to read in the daylightNo built in meat probe, only reports the temp of the box (and for temp regulation).My plan:I'd like to extend the functionality to address the two issues above. Namely, I'd like to add on an additional microcontroller (ESP8266, and/or Arduino) so that I can monitor temperatures, create alarms, timers, etc, from an app that I plan on writing. I'd also add the functionality of a meat probe. Long term, I'd like to be able to set the target temperature and timer, and turn the unit on/off, as well, and also plot data for my smokes over time.I've done some basic development with Arduino and the ESP8266, and I feel confident I can get the software side of the thing built. My issue is how to obtain the information that I want from the existing microcontroller on the board (it's as3f94c4ezz-dk94). My initial though was that I could read each pin on the 7 segment display, and programmatically determine what is being displayed. Not only does this seem sort of hacky (in a bad way) to me, it also presents issues. The display constantly cycles between the timer and the temperature on its own, so I'd have no way of distinguishing between the two (outside of the obvious looking for something like ":" to determine what is a time and what is a temperature), plus if someone physically pressed a button on the controller, the display would update accordingly and throw my output off.Frankly, I'm at a loss of where to properly begin here. I realize this is a vague problem for which I haven't made much headway yet, but I'm hoping some knowledgeable folks can point me in the right direction (and if you're local to Arkansas, I can pay you in delicious pulled pork or ribs!) . Attaching two pictures of the controller board. Thanks in advanced!

author: Marco
author_rank: Super Contributor
timestamp: June 02, 2015, 03:07:51 am
content: It would be by far easier to replace the whole controller save for the box and the buttons.On a hunch I googled a bit ... and there is at least one open source system already out there which should be easy enough to adapt to your needs,HeaterMeter.

author: NegativeTen
author_rank: Contributor
timestamp: June 02, 2015, 02:16:18 pm
content: Thanks for the response, Marco! I hadn't even considered replacing the entire controller. Before I tore into the controller, I was thinking I'd be able to get the output from a pin on the existing controller, and figure out what temperature it corresponds to, I didn't realize the controller was driving a 7 segment display in the way that it is. My only hesitation for replacing the controller is that if I'll have to write the code to control the heating element as well, which I'm a bit apprehensive about because of safety implications. Could it be as simple as turning the relay for the element on when the temperature falls below target, and switching it off again once it reaches temperature? I would think that it would be a bit more complex than this, and the logic that controls the heating element currently has some fancy equation to more smoothly regulate the temperature... I'll poke through that open source project you linked, although the similarities will be few because that project is for a coal smoker which is regulated by a blower, mine is an electric with a heating element.As a starting point, maybe I'll just add my mc to the mix and read the existing probe directly (assuming it's a something standard like a DS18B20), and add my own for meat temperature as well, without modifying the existing controller at all.

author: Marco
author_rank: Super Contributor
timestamp: June 02, 2015, 05:06:19 pm
content: HeaterMeter is a PID controller too, but you would have to dial in the PID settings a bit.

author: NegativeTen
author_rank: Contributor
timestamp: June 03, 2015, 07:44:49 pm
content: I did some more poking around and made some observations that I think will make this project relatively simple, given that my assumptions so far are correct.The image attached was taken by another user on another forum of my same model smoker. I'd have to drill out a couple dozen rivets to get access to the AC related guts down there.The wiring harness is as follows:Blue - Regulated +5v that's delivered when the unit is plugged in. I can power the Arduino from this. (I've read it's a bad idea to power an Arduino using the +5v pin unless it's regulated).White - thermistor wire. Has a 10K resistor in series and connects to an analog pin on the MC. Logic on the MC reads the voltage and determines the temperature.Black - GroundRed - Signal wire. When I set a temperature on the OEM controller, it sends ~3v down this wire, which activates the heating element. When the target temperature is reached, it shuts off. I'm making the assumption that the component circled in red in the attached image is a transistor that uses this ~3v to switch the relay that controls the heating element. What I can't figure out is how this 3v gets generated in the first place. The red wire connects to a 1k resistor, and traces to an output of the microcontroller. Since the microcontroller is driven from 5v, I would assume that a logic HIGH would be ~5v on that pin, not 3v.Is it possible that the MC does some voltage regulation inside? I can't figure out any other way that voltage would be generated, there aren't any other resistors that would act as a voltage divider on that trace. It also threw me for a loop that the +5v to the controller board was delivered on the blue wire rather than red.

author: Ian.M
author_rank: Super Contributor
timestamp: June 03, 2015, 07:56:23 pm
content: It may be a pulsed signal.Is the 5V supply fully isolated from the AC mains?* If so, simply check the signal with a scope.* If not, it gets a lot more interesting and you'll need to run it with the heater disconnected off an isolating transformer to scope it safely.

author: NegativeTen
author_rank: Contributor
timestamp: June 03, 2015, 08:18:37 pm
content: Unfortunately, I don't have access to a scope. The guy who took the image above was also kind enough to throw together a schematic:I'm just curious why the controller delivers the 3v at all to the transistor that signals the relay. I would think it would be far easier to just send it the 5v that the controller runs on, unless the controller is designed to output 3V as a logic HIGH. The datasheet doesn't really make any mention of that. The signal wire connects to pin 19 on the controller (again, through a 1k resistor). Pin 19 is described asP0.0/ADC0/INT0 (SCLK) in the datasheet, which says this:Bit-programmable I/O port for Schmitt trigger input orpush-pull output. Pull-up resistors are assignable bysoftware. Port0 pins can also be used as A/D converterinput, PWM output or external interrupt input.Also, the block diagram shows the chip has an IVC (Internal Voltage Converter) and says it's "not configurable," but doesn't make any other mention of it anywhere else.

author: NegativeTen
author_rank: Contributor
timestamp: June 03, 2015, 08:35:35 pm
content: Okay, so I powered the controller board with 5v from my arduino directly, not connected to the smoker at all. When the heating element is supposed to kick on, I get 4.8v across that signal wire. When it was connected to the smoker, I was getting 2.9v. Would a load on that line while it's connected to the smoker cause that much of a voltage drop? If so, that makes a lot more sense to me.PWM on that pin is a possibility (and the datasheet says that pin is capable of it), but what would be the reason behind using PWM to simply switch a transistor that controls a relay? If the signal was controlling the element by varying voltage to it, I could see the benefit there, but that's not the case.

author: Ian.M
author_rank: Super Contributor
timestamp: June 03, 2015, 08:58:41 pm
content: PWM would be likely if the relay had actually been an optoisolated TRIAC module, but it looks like its simply a crappy design that is close to overloading the MCU's output.

author: NegativeTen
author_rank: Contributor
timestamp: June 03, 2015, 09:18:07 pm
content: Is it expected that measuring the voltage without load would result in nearly 5v, and when there's a load on the other end (ie, connected to the transistor/relay/heating element circuit) that the measured voltage would drop to around 3v?

author: Ian.M
author_rank: Super Contributor
timestamp: June 03, 2015, 09:25:28 pm
content: That 1.7V drop may be excessive and indicates the designer has a base resistor on the transistor that is too low value - possibly because it doesn't have enough gain to drive the relay reliably with a higher value base resistor.Try measuring the current through that wire to the transistor - you will need to know that to make sure your controller has enough output drive capability.

author: NegativeTen
author_rank: Contributor
timestamp: June 03, 2015, 09:47:05 pm
content: Thanks Ian, I appreciate your help. I re-measured again and the output voltage without load is 5v, the output voltage with load was 2.9v, and the current with the element turned on was only 2mA.

author: Ian.M
author_rank: Super Contributor
timestamp: June 03, 2015, 10:00:15 pm
content: A 5V Arduino should be able to drive that fairly easily. As the coating on the power board prevents you reading any component values to check their ratings, I would suggest 820R in series with the signal from the Arduino to limit the current and get a similar voltage drop so you are operating the power board under the same conditions.

author: NegativeTen
author_rank: Contributor
timestamp: June 22, 2015, 04:16:12 pm
content: I've got the signal wire for the heating element sorted out, and now I'm attempting to read and interpret the thermistor, and I'm having some problems.The thermistor is a 2 wire 10k thermistor, though I'm unsure of the exact specifications. It was my assumption that the thermistor was part of a voltage divider circuit, and that the uC used the output voltage of the circuit, deduced the resistance at the current temperature and used an equation (Steinhart-hart) or lookup table to determine the temperature. I thought initially that the 10k resistor on the PCB where the thermistor wire comes in would be the other part of the voltage divider circuit, but that doesn't appear to be the case since it's just in line with the trace. Plus, the voltage directly off the thermistor wire is the same as the voltage where it gets read into the uC.Is there some other configuration that would make sense here, or must there be another resistor of known value in the circuit to function as a voltage divider? I'm really trying to avoid drilling out the couple dozen rivets on the unit to get access to the thermistor and related circuitry, but its looking like I might have to do that.

author: Ian.M
author_rank: Super Contributor
timestamp: June 22, 2015, 06:22:09 pm
content: Is it possible it has a cap to ground somewhere in the thermistor circuit? One alternative approach to using an ADC is to charge up a cap from the I/O pin, switch the pin to input mode then time how long it takes to discharge through the thermistor.If you are *CERTAIN* its a thermistor, then figuring out exactly how the existing controller uses it isn't essential. Have you tried simply heating the thermistor in situ with a hot air gun or similar while monitoring it with an ohmmeter? It would help if you can snake a type K thermocouple into the same location to get you the actual temperature for calibration.

author: NegativeTen
author_rank: Contributor
timestamp: June 22, 2015, 08:05:17 pm
content: There is indeed a cap to ground. If you look at the image attached above, there's a cap on the trace (C02) prior to the resistor. I had no clue what its purpose was, assumed it had something to do with the buzzer on the board since it goes there through a transistor. But with the board powered off, there's continuity between that cap and the ground pin. I had no clue that was an alternate approach, it very well could be how the uC determines temperature.I am certain that it is a 10k thermistor, it was confirmed by the company (though they wouldn't give me much more information than that, just saying that it "had very similar properties to other 10k thermistors on the market", and that they use a lookup table). I don't have a heat gun, and the end of the probe is in such a poor location that it's tough to get in there. The heat gun would most likely heat the probe too rapidly for me to get accurate readings. I suppose I could try to get some readings at a few extreme temperatures and compare them to published data sheets on common thermistors to see how close it is, unless there are any other suggestions?

author: Ian.M
author_rank: Super Contributor
timestamp: June 22, 2015, 08:59:32 pm
content: Plan B: get a 10K pot, connect it to the original control board in place of the thermistor and draw up a table of resistance vs indicated temperature,

author: engineer_in_shorts
author_rank: Regular Contributor
timestamp: June 23, 2015, 11:42:50 am
content: please check the earthing on the chassis is secure around that pcb. Only for my own sake.

author: NegativeTen
author_rank: Contributor
timestamp: June 23, 2015, 04:51:18 pm
content: Quote from: Ian.M on June 22, 2015, 08:59:32 pmI did try that initially when I was working under the assumption that it was a voltage divider circuit, but I was measuring the voltage rather than resistance. I'll give this a go with a 50k pot (the thermistor is at 10k @ ~75*F, the range of the smoker is from around 100*-275*. Thanks for the tip!Quote from: engineer_in_shorts on June 23, 2015, 11:42:50 amI'm not sure I follow you here. The PCB is grounded through a lead in the harness.

author: Ian.M
author_rank: Super Contributor
timestamp: June 23, 2015, 07:17:47 pm
content: I was assuming a NTC 10K thermistor that would drop to well under a K at 125 deg C (275 deg F). If you aren't certain if its NTC or PTC, well a 50K pot will do no harm!

author: NegativeTen
author_rank: Contributor
timestamp: June 25, 2015, 12:26:48 am
content: Still having some difficulty here, I'll explain what I have setup, hopefully someone can point out my fault(s)!(Please forgive the lack of an actual circuit diagram)+5v(vin) -> 4.7k ohm resistor(r1) -> input to 50k pot (r2).Wiper from pot -> input to OEM controller board(vout)other leg on pot -> groundThere's a 10k resistor on the controller board right off the input pin.I measured vout to be between 391mV and 3.732v in this setup and got a temperature range on the LCD of between 71*F and 292F. Using r2=r1((vin-vout)/vout), I get a range of resistance that doesn't correspond to what is supposed to be a 10k thermistor. (ie, 55k at 71*, 1.6k @ 292*F). And, of course, none of this takes into account the 10k resistor on the PCB between the uC and the thermistor.

author: Ian.M
author_rank: Super Contributor
timestamp: June 25, 2015, 01:28:55 am
content: No. You need to use the pot as a simple variable resistor. Connect one end of the pot and its wiper directly across the two thermistor terminals on the old controller. The other end of the pot can either be connected to its wiper or left open circuit. You will need to disconnect the pot to measure its resistance. Don't bother trying to measure voltage, it wont help.

author: NegativeTen
author_rank: Contributor
timestamp: June 25, 2015, 03:07:19 pm
content: The old controller only has one thermistor wire going to it, other than ground. I attempted to connect the pot between ground and the thermistor wire to the controller and the controller displayed an error. The same error that gets displayed if the temperature is out of range (either too high, or too low). I also tried connecting the pot to +5v and the thermistor wire as well, same results.I measured the voltage between the thermistor lead on the smoker (without the controller) and ground, and it was around 1.1v. This was with no controller connected, just the smoker plugged in and measuring between ground and the thermistor wire. If the controller was using the discharge rate of cap to calculate temperature, there shouldn't be any voltage across the thermistor and ground, right? This is making me think that it is a voltage divider circuit after all.I might just have to break down and take off the back cover to see what else is going on under the hood.

author: LukeW
author_rank: Frequent Contributor
timestamp: June 25, 2015, 09:03:40 pm
content: Quote from: NegativeTen on June 03, 2015, 08:18:37 pmLooking at that schematic you've posted, I would expect to see an electrolytic capacitor after the bridge rectifier and another capacitor at the output of the regulator.I think they really exist, looking at the photo, but aren't shown on the schematic.There is probably another resistor/capacitor in the thermistor circuit where it connects to the microcontroller, let's just assume (as discussed in your other posts) that this is somewhere inside the "microcontroller block" as shown on your schematic.What voltage do you get after the rectifier/capacitor, at the voltage regulator input? I would guess something like 12V. Or just look at the relay, which should probably answer that question. What's the relay coil voltage rating? If you get the relay model, then the current requirement can tell us whether the transistor is appropriate or what transistor/resistor you should use to drive it off the Arduino (or similar).And what's the voltage at the voltage regulator output? That's 5V, right? If that's a 7805, or equivalent, using it to drive the Arduino's 5V rail should be fine.I suppose it's possible (but unlikely) that one of the SOT23 components on the microcontroller board is a 3.3V regulator and the microcontroller is outputting 3.3V logic levels. I doubt it, though.OK, so you've got your relay coil connected to the 12V (or whatever) unregulated rail, and connected to the usual sort of NPN low-side open collector switching transistor, which is what you'd expect. There's also the series base resistor - I think that's on the board too, as you'd expect.I'd also expect to see a flyback diode across that relay coil - it's not shown on the schematic but I hope it's actually there on the board.Unfortunately that conformal potting stuff on the board looks like it's going to make things horrible to work with.If you disconnect the signal between the base resistor and the microcontroller and connect it to the +5V rail (the transistor side, that is, not the microcontroller) does the relay turn on?

author: NegativeTen
author_rank: Contributor
timestamp: June 25, 2015, 10:13:03 pm
content: Luke, thanks for the reply. The schematic I posted was found on another forum that was drawn by a user that did a similar mod as me (though used an SSR and an off-the-shelf PID controller), so it's most certainly incomplete. I believe I've got the details of switching the element on/off ironed out, the main issue I'm facing now is in regards to the thermistor as the previous few posts have discussed with Ian. Going to flag your post and come back to re-read it when I have more wits about myself and make sure I follow everything you've said. Thanks!

author: NegativeTen
author_rank: Contributor
timestamp: August 20, 2015, 09:48:33 pm
content: So this project stayed on the shelf for a while and I finally have time to pick it back up. I've made a little bit of progress, though I'm still having some issues.Through the process of trial and error, I can say with relative confidence (take that with a grain of salt...) that the missing link to the assumed voltage divider circuit is a 1K resistor to ground that's inside the the chassis of the smoker. I was able to simulate this on breadboard with a small 10K NTC thermistor and 1k resistor, and +5V regulated through an arduino (powered externally). I attached this to the OEM controller board, and it displayed the correct temperature. I then hooked up the same circuit to my arduino with my code, and it displayed the same temperature reading. (~78*F)Success!! Or so I thought...I took it outside, plugged the arduino into the smoker, and turned on the heating element. Right away, my Arduino was displaying a temperature about 10*F higher than the actual temperature (displaying 104*F vs 94*F actual at the time). For the first few minutes of heating, this 10*F difference remained, so I figured I could just account for that in the code. Once the temperature started climbing, though, the difference increased to 15*F, then to 20*F, and ultimately it was 30*F off (reading 250*F at an actual temperature of 220*F). I understand that the profile of thermistors isn't linear, which explains the increasing margin of error across a wider temperature range, but I'm unsure of how to adjust for this in my code (or at the hardware level?). Below is the code for determining temperature, I'm using coefficients for the Steinhart-Hart equation from the web, as it seems most normal 10K thermistors have similar values.One thought I have is that since I'm powering the Arduino from the +5V of the smoker, maybe that's affecting the values read by the ADC? Any help or insight is appreciated!Code:float a = 0.001125308852122;float b = 0.000234711863267;float c = 0.000000085663516;void loop() {adc = analogRead(A0);// 1000.0 being the value of the other resistor in our voltage divider circuitTemp = log(1000.0*((1024.0/adc-1)));Temp = 1 / (a + (b + (c * Temp * Temp ))* Temp );TempC = Temp - 273.15; // Convert Kelvin to CelciusTempF = (TempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to FahrenheitSerial.print("ADC: ");Serial.print(adc);Serial.print(" Temp (C): ");Serial.print(TempC);Serial.print(" Temp (F): ");Serial.println(TempF);///}