OK. I am following you now. Just one question… in an earlier reply you said instead of using /.005, I should use *200. How did you come up with that figure? I know dividing or multiplying, it’s the same thing, but just curious on how to do the math for that.
From 1 / 0.005 == 200
follows x / 0.005 == x * (1 / 0.005) == x * 200
OK. Thank you so much! I have made some adjustments to my code. I don’t need the decimal places after the reading, so I nixed those. So basically, I had to convert from the analog reading back to a voltage, so I could subtract a voltage and get a Celsius reading. Then I had to convert Celsius to Fahrenheit. Now I am getting the proper temperature reading I was looking for. Here’s a paste of my code:
Vout = analogRead(A2);
temp = (Vout * .008) - 1.25;
temp = (temp * 9.0)/ 5.0 + 32.0;
lcd.print(temp, 0);
lcd.setCursor(4,1);
lcd.print(" deg F");
delay(5000);
Again, thank you! Lots of subtle differences from the Arduino to the Photon!
UPDATE!!!
OK, so with the generous help of some of the fine folks on this forum, I was able to make some progress on this project today. I am now able to read the smoker pit temperature (in Fahrenheit) on my LCD screen. I have also started working on the menus and made a flowchart of what the menus will be (as reference during coding). I admit that there are quite a few differences between coding on the Arduino and coding on the Photon! I was having non-stop issues with formatting my code and, in particular, bracket placement such that I decided (at least for now) to go back to my Sparkfun Redboard (Arduino UNO copy) and a 4 relay relay shield I had for the Redboard. The only advantage to this is the fact that most of the coding examples I can find are written for Arduino, so I can use snippets of those examples as-is. The differences between Photon and Arduino are making it very difficult for a coding novice, such as myself, to actually write the code.
If anyone has any input on this matter, or can tell me that I am being a fool going back to Arduino, please let me know! Ultimately, I would like to be able to control this smoker from my phone or over the internet, but first priority is being able to control it locally, at the smoker itself!
Thanks!
What major coding differences did you see?
e.g. AFAIK the way how analogRead()
works and the readings are converted to voltages are the same (with the minor differences of 3.3V vs. 5V - which is also present between 3.3V and 5V Arduinos - and having a 12bit resolution over a 10bit on Arduino) - contrary to your statement in the post about Farenheit calculation.
Also the placement of braces and parentheses is exactly the same - as it should be due to both being built ontop of C.
And the formatting (as I understand the word) is mainly for human readability, the compiler doesn’t care about indetation (unlike Pearl or other languages). If you wish, you could write your code as one long line of code on both platforms.
Could you post some code that would run on Arduino but not on Particle, to let us see what you’re struggling with.
Maybe we can open the Gordian Knot for you.
The major differences are mainly on the hardware and library side and not the language as such IMHO.
Sorry for the delay in response…had to step away from the project for a little while for my own sanity!
UPDATE: So I went ahead and went back to using the Arduino Uno R3 along with a relay board I had on hand and a 16X2 RGB LCD from Adafruit. I have written some basic code:
-
Upon initial startup, temperature of smoker (essentially ambient temp, give or take) is read and if it is below 100 degrees Fahrenheit, the unit will go into Startup mode.
-
Startup mode turns the igniter on for 1 minute first, then turns on the fan and then the auger starts feeding pellets for 10 seconds, then the auger stops. There is a 1 minute delay, then the auger comes on for another 10 seconds, then another 1 minute delay. This continues on for 6 cycles.
-
Once the temperature is above 100 degrees, the igniter is turned off (for the rest of the cook).
-
Cook mode (temporarily) is set at 250 degrees Fahrenheit through the following method (there is no rhyme or reason to how many pellets will be fed. You just have to go with the law of averages here!). If the temperature falls below 240 degrees, the auger runs for 6 seconds, then delays for 30 seconds until the smoker rises above 240, then the auger shuts off.
-
Shutdown. Right now I have just put a SPST rocker switch inline on the power lead to the auger. When I want to go into shutdown, I just turn the switch to the “OFF” position so that no more pellets can be fed into the firepot and the smoker will die off. Once the temperature is below 100 degrees, I go ahead and shut everything down.
As far as the differences with the code, I guess I was just freaking out over the resolution/voltage issue when I had to redo the formula for the temperature probe. The coding is no different from Arduino and I should be able to pull my Arduino code I have written over to the Photon without much trouble. I think I just needed to work with something I was already familiar with and get the bugs worked out on that so I don’t have so many problems at once to bring to the Photon (which is a new product for me).
I DO have an occasional issue with the LCD screen freaking out on me. Sometimes it will show some crazy, foreign characters on the screen and then just keep populating even stranger characters afterwards. I have found that the only way to “fix” it is to cycle power to reset LCD display. Any ideas?
Also, I had a Seeedstudio 2.8" TFT Touchscreen on hand that I was considering using for this project, but the problem is that it uses D4 through D7 (so does my relay board), D11 through D13 and A0 through A3! That uses up a lot of pins! Does anyone have any recommendations on a different touchscreen that doesn’t use so many doggone pins?
Thanks!
@JayBirde, take a look at Digole displays - www.digole.com
Or, the Nextion displays - https://www.itead.cc/display/nextion.html
Thanks PK! Just ordered 2 of the Nextion displays. A 3.5" standard (for right now!) and a 3.2" Enhanced (ships June 1). Looks like the perfect solution and only 4 wires!
I’m working on a similar project with a Traeger pellet grill. I purchased a 4 relay control board from controleverything.com to control: auger, combustion fan and hot rod along with a thermocouple board from Adafruit. I’ve been planning to use the Blynk app as my interface and have it designed and basically working. However, since I got started Blynk changed their licensing scheme, so I don’t know if I’ll stay with that or switch to something else (Porter?).
I’ve had some strange anomalies with the system and believe I need to introduce some suppression capacitors, at least in the combustion fan and auger motor circuits as recommended by the control everything folks. I also had to add a WiFi extender in order to get coverage behind my house.
In our climate, the pellets seem to like to disintegrate and then solidify in the auger, forcing me to go through a laborious tear down clean out procedure. One of the functions I’ve coded is a clean-out function by which the control will run the hopper-auger out of pellets and then automatically shutdown when it’s out of pellets–the temp will drop a significant amount.
I had burned out 2 Traeger controls and felt I could design my own for about the same amount of money $90 and make it more robust. At this point in time, I’m still using my propane grill…the project wasn’t quite as easy as I had hoped!
In the end, I believe it will be much nicer for several reasons:
I can get an alert when it’s up to temp
I can see the temperature at any point in time via a graph
I can easily change the operating temp from my iPhone
The auto clean-out referenced above
More robust electrical controls won’t burn out like the mfgr’s
Very nice, Tom! In my testing, so far, I haven’t had any issues with the fan or the auger. Right now, I just have code written to keep the temp around 250 degrees and it stays pretty close to that setpoint. I have ordered a couple of touchscreens to implement, so that should make the control side a little easier.
Let me know how the iPhone control works. That would be something I would be interested in implementing into my project too!
Yes, you can control your http://thesmokergrill.com
(Moderator’s advice: navigate at your own risk) using your mobile through internet or Bluetooth.
@williams the link you provided is on your internal network. Also, did you use a Particle device for your solution?
what you wanna say?
If the post is not related to Particle devices it’s probably not suitable for this forum as it is for those products only.
It’s related to this thread.