|
Post by papa on Dec 5, 2017 23:05:32 GMT
Some years ago, my first complex Arduino project was a Yogurt Controller which implemented a typical slow cooker recipe. It used a DS18 temperature sensor, a DC to AC solid state relay, a piezo speaker to signal the end of recipe steps, & a 16 pin, 16 x 2 LCD to display temperature & time progress. Using flags, I was able to program the 3 recipe steps in the main loop() section. That device made a lot of yogurt. As I gained experience, I've considered an improved version. I saw various versions of a yogurt controller & this one by Chris Reilly at MakeZine intrigued me. It also used a piezo. It put the recipe steps in the (run once) setup() loop. I liked aspects of its programming, including for holding something at a certain temperature for a certain time. I did not like how feedback was only on the serial monitor, requiring a computer connection. I wanted to be able to run preset recipes (like yogurt) AND have an option for DIY recipes. I wanted a way to enter options & settings for recipe steps. For this, I hoped to use a potentiometer to "dial" a value & use a push button to select that value. For feedback & choosing options, I wanted to use a 4 x 20, I2C LCD (only 4 pins to connect & leave Arduino pins for other things, including a RFM69 radio). I wanted to connect things using similar pins as I used for RFM69 projects. I wanted to use the Arduino's EEPROM memory (not lost when power goes off) to store recipe values & use that to continue a recipe interrupted by a power outage. I believe I achieved the above & the Buono Uno Arduino compatible had enough power to handle it all. Slow cookers tend to "coast" up in temperature after power turns off. I did not use complex programming to "tune" temperature accuracy to a slow cooker's responsiveness. I did add a "coast" factor of 1.5 degrees F (.833 degrees C), which works well for my slow cooker. This controller might be useful for cooking other foods at fairly accurate temperatures. My Cooking Controller sketch adapts Reilly's code, mixes in some of my former yogurt controller, & adds input getting & using the EEPROM. I also use a different temperature sensor than Reilly's. This thread will document the device. Later in this thread documents my adding the RFM69 radio & OpenHAB connection to the Cooking Controller.
|
|
|
Post by papa on Dec 5, 2017 23:09:15 GMT
Schematic for the Programmable Cooking Controller With NO RFM69 Radio to Communicate with OpenHAB Caution: This is a complex project with many connections. I recommend that you have experience with building Arduino projects before you start this one. << Click on pic for larger view Please do not change the connections to the Arduino pins. An updated schematic & sketch below will allow this device to report to OpenHAB via RFM69 wireless radio. The radio will need several of the pins not used in this schematic. Ahead: Shopping list, hints for building, the Cooking Controller sketch
|
|
|
Post by papa on Dec 7, 2017 17:08:43 GMT
Cooking Controller Shopping List to Get You StartedA 3.3 volt switchable Buono Uno Arduino Compatible about $10 US, about $9 if purchased 5 at a time. Power adapter for the Buono Uno: a 5 volt USB phone charger type An Arduino Prototyping Shield (with button reset & extra push button) that can be made 3.3 volt friendly about $5 US OR (temporarily??) a solderless breadboard with power & Gnd rails breakaway female headers LCD (4 x 20, 4 pin I2C interface) Front & back, my LCD & I2C serial interface look similar to the one sold here. As you see it is 4 rows by 20 columns & the I2C interface is labelled YwRobot Arduino LCM1602 IIC VI. Here's another from a U.S. vendor I like that may also work in a similar way. Potentiometer / Variable Resistor ("Pot," 10 kilo ohms) pins on the bottom, 2 on one side, 1 on opposite side, a knob to dial input values Something like this might work for initial set up. 3 volt capable Piezo speakerDS18x20 Temperature Sensor with waterproof cable & protection usually red wire is power, black wire is GND, & 3rd wire is data. SSR-25 DA DC to AC Solid State Relay some have plastic covers, but don't protect very well. See this post for a homemade cover, but putting the SSR in a project box would be better (see the next post for related parts). If you plan to use a project box, protect the relay's AC terminals with electrical tape. a grounded extension cord to cut & connect to the SSR's AC output or a grounded outlet The cooking device's power cord plugs into this. If you plan to use a project box, have a couple feet of wire (with hot, neutral, & ground wires) plus male & female ends to add after each wire end emerges from the project box. BC547 or other NPN transistor 2.2 kilo ohm resistor 7.7 4.7 kilo ohm resistor << resistor corrected on 12/14/2017 (color-coded??) 22 gauge wire & DuPont cables for connections including 4 short male to female cables Using parts like the above I have built a controller that works, but is not unified. A project box & related parts (next post) would help. Ahead: project box parts, some hints for building & the Cooking Controller sketch
|
|
|
Post by papa on Dec 14, 2017 16:59:58 GMT
Other parts probably needed for a neater, safer final result in a project boxAfter you have the controller working & can see what size you need: A project box to avoid shock hazards I just received this project box & I believe it will work for this. Of course, we'll need to make holes for AC wires, power supply wires, potentiometer & push button & a way to mount the LCD. We'll likely need a potentiometer something like this with a nut to mount on the outside of a project box. We'll likely need a push button (with mounting nut) like this to mount on the outside of the project box. 12/26/2017, ^^ the link was corrected to a normally OPEN push button. The previous linked item was normally CLOSED.
|
|
|
Post by papa on Dec 14, 2017 22:39:40 GMT
Some Hints for Building the Cooking ControllerLeave Arduino female headers for D10-D13 unobstructed so you can add an RFM69 radio later. Following the schematic in this Cooking Controller thread, follow this adapted post (originally about only a DHT end node) to build an Arduino prototyping shield for the controller. The controller uses a DS18 temperature sensor instead of a DHT sensor. Follow steps 4a, 4b, 4c, 5, 6a, 6b, 6c, 7, 9, 10a, 10b, 11, 12, 13b, & 14-19. Use 2 male to female Dupont cables to connect the piezo speaker's pins to Arduino D7 & GND. Across the middle "valley" of the solderless breadboard, install the cheaper potentiometer (with no mounting nut). With jumper wires, connect the two pins on one side of the pot with female sockets Arduino's 3.3 volts & GND. Connect the one pin (wiper) on the pot's other side with Arduino A0. On the project box's cover, you'll mount the potentiometer with a nut & make similar connections.
|
|
|
Post by papa on Dec 15, 2017 16:12:30 GMT
The Cooking Controller SketchI included extensive comments & variable names that I hope will help you understand & use this sketch & operate the Cooking Controller. In this post, see comments on operating the Cooking Controller. Opening comments give some guidance & explanations, including choosing between Fahrenheit & Celsius temperature scales about line 57. This post also guides operating the Cooking Controller. The LCD screen will give more limited instructions & feedback. At this post, forum members may download the latest Cooking Controller Sketch. ^^ Joining is FREE. (:-)
^^ This RFM21 version (updated 3/31/2018) of the Cooking Controller sketch is improved from earlier.
If you do not install an RFM69 radio on this controller & do not make & program an RFM69 Gateway to communicate with this controller, you may want to disable (comment out) #define RADIO which avoids compiling the sketch's radio-related code.
The improved cooking controller will now work with radio code included, with or without radio connection to a gateway. Without radio connection, the LCD will not show updates for about the first 5 of 60 seconds. When radio transmission fails, the controller will disable it & then try to re-enable it every 0 of 60 seconds. When radio transmission is succeeding, a "T" shows at the LCD's right side. Failing transmission displays "-" instead of "T"
When the cooking controller is activating the relay for the cooker to heat, an "H" shows at the LCD's right side. With heat off, a "-" displays. As HH:MM:SS, the LCD also displays either Total time since execution started OR how long the current targetTemp has been Holding.
Earlier, the sketch sent OpenHAB the current temperature only at the start of a step & when the controller was holding at a targetTemp. Now the sketch also sends the current temp while it works toward the targetTemp. Next: Using EEPROM memory to hold data even when power is interrupted.
|
|
|
Post by papa on Dec 15, 2017 16:24:26 GMT
Using EEPROM memory to hold data even when power is interrupted
The above post has a sketch to control cooking with a heating element. In EEPROM, it stores key data from "recipe" steps & can resume after power is lost to the Arduino. The sketch's EEPROM related coding is below.
int minsChunk ; // mins between storing lapsed times in EEPROM unsigned long milliStore ; // millisecs between storing lapsed times in EEPROM int lapsedStoreslast = 0 ; // track last hold time stored so wait for next chunk to elapse before storing again
#include <EEPROM.h> // This library gives functions for EEPROM usage
// function to clear the EEPROM past what is used void clearEEPROM () { for (int i = 0 ; i <= (maxSteps * 6) ; i++) { EEPROM.write(i, 255); } }
I mapped my usage of EEPROM memory locations as follows: 0) current recipe step 1) Total Steps 2) hours elapsed 3) minutes elapse 4) not used yet recipe step 1: 5) targetTemperature 6) Hours to Hold 7) Minutes to Hold 8) Minutes to make sound & hold for button push 9) array index to step message ("heating," etc) recipe step 2: 10) targetTemperature 11) Hours to Hold 12) Minutes to Hold 13) Minutes to make sound & hold for button push 14 array index to step message ("heating," etc) recipe step 3 15) etc.
I write & read locations 0-3 individually. After that each recipe step has 5 values & its first value's location is evenly divisible by 5 so I can use for loop(s).
for (int k=5; k <= 19; k++) // yogurt recipe's 15 values (3 steps of 5) from an array are stored in EEPROM starting at location 5. { EEPROM.write(k, yogurtVals[k-5] ); // in EEPROM 5-19, save yogurt recipe values }
for (int j = 1; j <= ttlSteps; j++) // read 5 stored values for each step { int addrE = j * 5 ; // start at EEPROM location 5 targetTemp = EEPROM.read(addrE) ; // temp Target for this step hoursTarget = EEPROM.read(addrE + 1) ; // hours to hold temp for this step minsTarget = EEPROM.read(addrE + 2) ; // mins to hold temp for this step buzzMins = EEPROM.read(addrE + 3) ; // sound duration / wait for push button at end of this step msgIdx = EEPROM.read(addrE + 4) ; // index to message for this step }
Key information about using EEPROM memory: From here, Arduino Uno compatibles have 1024 bytes and each byte of the EEPROM can only hold a value from 0 to 255. (Online are methods for overcoming this limit.) From this tutorial: "AVR’s internal EEPROM memory has a limited lifespan of 100,000 writes per EEPROM page — reads are unlimited. ... in your application, try to keep writes to a minimum." Though this discussion suggests lifespan might be much more or less, perhaps depending on the approach to writing. (If a sketch like mine uses a small portion of EEPROM, one could later change the sketch's EEPROM address references to use another area of EEPROM.)
Depending on the application, one must consider how often to store in EEPROM memory. For example, dealing with hours on task, one might limit EEPROM stores to every 15 minutes, which is 4 times an hour vs 60 times an hour (every minute) or 3600 times per hour (every second) or 3,600,000 per hour (every millisecond). For time targets less than 4 minutes, I coded stores once per minute. For time targets of 4 minutes-11 hours, no more than 4 stores per step. For higher time targets (12-23 hours), no more than 2 hours between stores. In addition, at least once per recipe, the EEPROM area used is cleared by writing 255 to each byte. The minsChunk formula below calculates for my approach.
minsChunk = ( ( ( (hoursTarget * 60) + minsTarget ) / 4 ) + 1 * ( ( (hoursTarget * 60) + minsTarget ) < 4 ) ) ; if (minsChunk > 120 ) minsChunk = 120 ; // For 12-23 hours, no more than 2 hours between stores // ^^ ^^ For one hour between stores, change both 120's to 60
milliStore = minsChunk * 60000 ; // convert minutes chunk to millis int lapsedStores = ( millis() - startTime ) / ( milliStore ) ; // count milliStore minutes since targetTemp reached (startTime)
// only if one more chunk of hold time minutes has passed zero, store hours & minutes lapsed at targetTemp if ( (lapsedStores != lapsedStoreslast) ) { minsLapsed = lapsedStores * minsChunk ; // calculate total elapsed minutes hoursLapsed = minsLapsed / 60 ; // convert lapsed minutes to even hours minsLapsed = minsLapsed % 60 ; // minutes left that make less than an hour
EEPROM.write(2, hoursLapsed ) ; // store hours elapsed EEPROM.write(3, minsLapsed ) ; // store minutes elapsed lapsedStoreslast = lapsedStores ; // update last chunk of hold time that was stored }
|
|
|
Post by papa on Dec 22, 2017 22:22:59 GMT
EEPROM Memory Does Get Corrupted from Many Writes. How to Handle That.As I quoted above: "AVR’s internal EEPROM memory has a limited lifespan of 100,000 writes per EEPROM page — reads are unlimited. ... in your application, try to keep writes to a minimum." After much testing & troubleshooting, I experienced corruption of the EEPROM area I was using. When attempting to read a value there & to display it on the LCD caused the LCD screen to go wonky. In the sketch, I moved the start of the EEPROM area to be used & I was back in business. To allow for this in the updated sketch above, I added the line: int offSet = 0 ; // Start of EEPROM area used for storage, add 30 when this area corrupts from writing So if EEPROM bytes 0-29 corrupt, change 0 to 30. The next value to use would be 60 Ahead: Adding an RFM69 Radio to the Cooking Controller & Communicating with OpenHAB
|
|
brump
Junior Member
Posts: 81
|
Post by brump on Dec 23, 2017 1:42:49 GMT
EEPROM Memory Does Get Corrupted from Many Writes. How to Handle That.As I quoted above: "AVR’s internal EEPROM memory has a limited lifespan of 100,000 writes per EEPROM page — reads are unlimited. ... in your application, try to keep writes to a minimum." After much testing & troubleshooting, I experienced corruption of the EEPROM area I was using. When attempting to read a value there & to display it on the LCD caused the LCD screen to go wonky. In the sketch, I moved the start of the EEPROM area to be used & I was back in business. To allow for this in the updated sketch above, I added the line: int offSet = 0 ; // Start of EEPROM area used for storage, add 30 when this area corrupts from writing So if EEPROM bytes 0-29 corrupt, change 0 to 30. The next value to use would be 60 Ahead: Adding an RFM69 Radio to the Cooking Controller & Communicating with OpenHAB Hi Papa, Congratulations on the evolution of your project. Concerning your EEPROM write cycle, you could use an external eeprom. For example, AT24C256, it has 32K. Ps: Merry Christmas and a Happy New Year!
|
|
|
Post by papa on Dec 23, 2017 15:17:02 GMT
Merry Christmas and Happy New Year to you also, brump. I've enjoyed your contributions to this forum.
Thanks for noticing my post on EEPROM write corruption & your suggestion of an external EEPROM.
At the same time, since I only use 30 bytes at a time for this sketch & I limit the writes, even the Buono Uno's EEPROM should last a good time.
Still your suggestion may be very useful to me or others in the future. I value your knowledge of electronics.
|
|
|
Post by papa on Dec 23, 2017 15:18:47 GMT
Adding an RFM69 Radio to the Cooking ControllerI amplify my earlier caution: By adding an RFM69 radio, this is an even more complex project with many connections. I recommend that you have experience with building Arduino projects before you start this one. Even if you have experiences with Arduino projects, BUT you have not yet built this forum's RFM69 projects, I strongly urge that FIRST you use this thread (& its links) to build your first RFM69 wireless network. That will give you the simplest possible introduction to what is needed for the following. Besides, in order for this version of the Cooking Controller to communicate wirelessly with OpenHAB, you need to build the separate RFM69 Gateway device that is covered in that thread & its links. In this post is a newer sketch version. It improves on earlier versions, including for when a step's targetTemp is lower than the just previous step plus disabling failing radio transmission (so local node functions work) & re-enabling transmissions if they resume working. Ahead: Schematic for the Programmable Cooking Controller with RFM69 Radio
|
|
|
Post by papa on Dec 29, 2017 22:29:31 GMT
Schematic for the Programmable Cooking Controller With RFM69 Radio to Communicate with OpenHAB << Click on pic for larger view See the posts starting here, for a list of parts needed. To that list, add the RFM69 radio (upper right of the schematic) at your chosen frequency & add wires to connect the radio. If you have not built the Gateway yet, buy at least one more RFM69 radio. Starting here, read these posts about choosing an RFM69 frequency & working with the device. Those posts were written for the separate RFM69 Gateway, but the only difference is the Gateway uses D 8 for the RFM69's NSS. The cooking controller & other non-gateway devices use D10 for NSS. At this link is one example of an RFM 69 radio, 915MHz, high power RF output. At your favorite shopping site, you can search for "RFM69HCW" plus your chosen frequency (433, 868, or 915)
|
|
|
Post by papa on Dec 30, 2017 15:54:01 GMT
Download & Customize the Cooking Controller Programming Cooking_Controller_RFM22_pub.ino (31.55 KB) << Here, forum members may download the Cooking Controller Sketch, updated 1/15/2019. Joining is FREE. (:-)At 2 posts starting here, see how versions 21 & 22 improved. In the Arduino IDE, open the sketch & customize it with the following edits: Choose your temperature scale in the lines that include #define FAHR & #define CELS. UNcomment the line of your choice (no // at the start) & leave the other line commented. If you UNcomment the line with #define RADIO (no // at the beginning), this will program the cooking controller with radio coding. Likewise, if you do NOT install an RFM69 radio on the controller & do NOT make & program an RFM69 Gateway to communicate with it, disable the line like this // #define RADIO The following assumes this will be Node 18 (your choice as long as you are consistent). If not, in the line with NODEID changed the number & use it consistently later. After ENCRYPTKEY, replace the "xxxxxxxxxxxxxxxx" with the same 16 character key you created & put into the Gateway Node sketch. Make sure the line with DEBUG, is uncommented (NO "//" at the start). Select the FREQUENCY of the RFM69 radios you have. Be sure that the same line is uncommented & activated as you do for the Gateway Node & that the other lines are commented out. (If & when you build more end nodes, be sure you give each node a unique NODEID number.) If (as I recommended), you buy RFM69 radio transceivers with "H" in their part number, UNcomment the line with #define IS_RFM69HW. The line with SERIAL_BAUD assumes Arduino IDE Serial Monitor communicates at 115200. If not change the number in the sketch or the Serial Monitor.
|
|
|
Post by papa on Dec 30, 2017 16:23:42 GMT
Program the Cooking Controller to Communicate Wirelessly with OpenHAB
If (as I recommended), you successfully built & programmed a Gateway device, you already installed RFM69.h, the supplemental code library the radio needs. If you don't have the RFM69 library yet, get it here (also about line 71 of the sketch). Download the library's .zip file to where you can find it. To install it, in the Arduino IDE, navigate in the menu to Sketch/Include Library/Add .ZIP library... Browse to where you saved the library's .zip file. << corrected 4/1/2018Insert one end of a USB cable into the lower level (Buono Uno) of the assembled Gateway & the other end into the computer where you'll use the Arduino IDE to load, edit, & upload the Arduino sketch program that is the Gateway programming. Before uploading, I find it helpful to use the verify feature & let it tell me if it finds sketch problems to fix. ( See this post & also see this post about "other available troubleshooting tools.") Using the upload feature of the Arduino IDE, while the Cooking Controller's Arduino connects to your computer via USB, send the customized Cooking Controller sketch program (ending in .ino) to the Arduino. Ahead, Operating the Cooking Controller
|
|
|
Post by papa on Dec 30, 2017 17:04:00 GMT
Operating the Cooking Controller
After you've successfully uploaded the programming to the Cooking Controller (it can take more than one try) & the Controller is still connected to USB, start the Arduino IDE's Serial Monitor. It should show "Node 18 Transmitting at 915 Mhz... Wait to see minutes held at targetTemp."
The LCD screen should display a brief instruction screen then a menu screen: 1) Yogurt Recipe 2) Test 3) DIY.
Early lines of the sketch explain ... Based on temperature sensor readings, target temperature, & holdFor times, this program uses a relay to switch on & off an electric heating element (eg, slow cooker). LCD shows temperatures, lapsed time, prompts. Sound for buzzMins after all steps, unless button push stops it Choice 3 allows you to program your own "recipe" of holding pot contents at a temperature for a set time. Dial the item number with the potentiometer & select that number with the push button. You input Total Steps of your recipe, dial a value on the potentiometer, select it with the push button. Then for each step, input target temperature, hours & minutes to hold, how long to beep at the end of holdFor times, & the LCD message starting the step ("Heating" or "Cooling" or "Add Culture") To start over if you error, press the Arduino's reset button (or turn the Arduino's power off & on). Then the program executes the recipe steps & turns off the cooker's power at the end.
Choice 2 runs a preset "test" recipe of two steps (Fahr or Cels equivalent). (You can use body heat, room temp, & cool water to reach these temperatures): 1) Heat to 75F & hold, display "Heating", holdFor 0 hrs & 5 mins, sound off 1 min (unless buttons stops it) 2) Cool to 71F & hold, display "Cooling", holdFor 0 hrs & 4 mins, sound off 1 min " You can edit this or imitate it to create another recipe. Choice 1 runs a preset 3 step "recipe" for yogurt (Fahr or Cels equivalent). To prepare: add powdered nonfat milk (1/2 cup per gallon) to liquid milk & put heat sensor tip into the cooker's contents. For the last step, have ready a few tablespoons of plain yogurt that contains active cultures. 1) heat milk to 180F & hold for ten minutes (sterilize & denature milk enzymes). Then sound signals for 3 mins (push button stops it).
2) cools milk to 104F & hold for ten minutes (get ready to add yogurt culture). Then sound signals for 10 mins (push button stops it).
3) Holds cultured milk at 100F for 12 hours. (For less sour yogurt, reduce 12 in yogurtVals[].) Then sound signals for 10 mins (push button stops it). At end, heat is held off. If a power loss interrupts a recipe, the restarted sketch gives the options: 1) Continue the interrupted recipe (using values stored in the EEPROM) or 2) Clear the recipe & start over.
Ahead, Getting Results on the LCD Display
|
|
|
Post by papa on Dec 31, 2017 19:54:29 GMT
Getting Results on the LCD Display Opening Screens First (brief) Screen Second Screen , of Instruction Taking Input ^^ Now after "by Papa," a sketch version shows in parentheses. Ahead, Getting More Results on the LCD Display
|
|
|
Post by papa on Dec 31, 2017 20:04:43 GMT
More Sample Results on the LCD Display Yogurt Recipe, Step 1, Yogurt, Step 3, 7+ Hours Before targetTemp reached After targetTemp reached Per Cooking_Controller_RFM17_pub.ino, "T" now also shows to the right of the targetTemp when the node is successfully transmitting via RFM69 radio. "-" displays when RFM69 radio transmissions are failing & disbled.
"H" now also shows to the right of Temp when the relay is activated for the cooker to heat. Otherwise, "-" displays. Ahead, Connect the Cooking Controller's Data to OpenHAB
|
|
|
Post by papa on Dec 31, 2017 20:24:21 GMT
Connect the Cooking Controller's Data to OpenHAB
Taking several hours, cooking yogurt seems a good use of home automation. With set up so far, one can start the process & do nothing except add culture to the end. The LCD screen & piezo sound off give ongoing feedback about the process.
Now connecting to OpenHAB will allow one to monitor the process from a computer & better a mobile device. OpenHAB can "ding" our phone when the controller is ready for yogurt culture to be added. What other things might you cook if you could control temperature more precisely than a slow cooker on its own & be able to see & be notified about key points?
As stated above, to do this, you need to have successfully built & programmed an RFM69 Gateway. You also need to have OpenHAB 2 & the Mosquitto MQTT broker installed on a computer in your local network. This documentation addresses only what additions might be needed.
Addons to install & configure in OpenHAB 2: mqtt mail, pushover openhabcloud Add these entries to the addons.cfg file (services folder):
# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave") binding = mqtt1
# A comma-separated list of actions to install (e.g. "mail,pushover") action = mail,pushover
# A comma-separated list of transformation services to install (e.g. "map,jsonpath") transformation = scale
# A comma-separated list of miscellaneous services to install (e.g. "openhabcloud") misc = openhabcloud
Ahead, More on Connecting to OpenHAB
|
|
|
Post by papa on Dec 31, 2017 20:41:05 GMT
More on Connecting to OpenHABMost addons listed in the last post has its own config file in the services folder: With a non-Windows type text editor, open each .cfg file & add the needed information. Caution: Lines that start with "#" are comments & are NOT activated configurations. The OpenHAB 2 online documentation with search feature is pretty helpful, including for openhabcloud. Configuring Pushover (sends text-like messages & sounds to mobile devices) requires registration for "keys" & a mobile app (free for a week, a few bucks to buy after that) See some instructions here which start with Register Your Application (in this case OpenHAB). Ahead, More on Connecting to OpenHAB, Configuration Lines for the Cooking Controller
|
|
|
Post by papa on Dec 31, 2017 21:32:46 GMT
OpenHAB, items Configuration Lines for the Cooking Controller In OpenHAB2's items folder, create the Cooker.items file with these lines. String Node18Rssi "Cooker_18_RSSI (db)[%s]" <network> (Nodes) {mqtt="<[mosquitto:home/rfm_gw/nb/node18/dev02:state:default]", expire="3m,Offline?" } Number Target_Node18 "TargetTemp [%.1f °F]" <temperature> {mqtt="<[mosquitto:home/rfm_gw/nb/node18/dev68:state:default]"} Number Step_Node18 "Cooker_Step18 [Step %.0f]" <temperature> {mqtt="<[mosquitto:home/rfm_gw/nb/node18/dev69:state:default]"} Number Msg_Node18 "Cooker_Msg18 [SCALE(cook_msg.scale):%s]" <temperature> {mqtt="<[mosquitto:home/rfm_gw/nb/node18/dev70:state:default]"} Number Mins_Node18 "AtTargetTemp18 [%.0f minutes]" <time> {mqtt="<[mosquitto:home/rfm_gw/nb/node18/dev71:state:default]"} String hoursLapsed18 "AtTargetTemp18 [%s]" <time> Number Temperature_Node18 "Cooker_Temp18 [%.1f °F]" <temperature> {mqtt="<[mosquitto:home/rfm_gw/nb/node18/dev48:state:default]"}
Start here below for hints on using the Embedded MQTT Broker & MQTT 2.xx Binding which will change the above item entries .
|
|
|
Post by papa on Dec 31, 2017 21:35:31 GMT
OpenHAB Transform Configuration Lines for the Cooking Controller
In OpenHAB2's transform folder, create the cook_msg.scale file with the following lines
[..5]=Pending [6..6]=Heating [7..7]=Cooling [8..8]=Add Culture [9..10]=Error [11..11]=Finished ! [12..]=Error
|
|
|
Post by papa on Dec 31, 2017 21:48:38 GMT
OpenHAB Rules Configuration Lines for the Cooking Controller
In OpenHAB2's rules folder, create the Cooker.rules file with these lines:
rule Cooker_Step_Now when Item Msg_Node18 changed then var String M18 = Msg_Node18.state.toString
var String process = transform("SCALE", "cook_msg.scale", M18)
sendMail("YourGmail@gmail.com","from openhab","Cooker Step: " + Step_Node18.state.toString + " " + process ) // ^^ replace with your gmail address
pushover("Cooker Step: " + Step_Node18.state.toString + " " + process)
end
rule CookerMins2Hours when Item Mins_Node18 changed then val int m18 = (Mins_Node18.state as DecimalType).intValue val int hoursPart18 = m18/60 val int minsPart18 = m18%60
hoursLapsed18.postUpdate(hoursPart18 + " hours, " + minsPart18 + " mins") end
|
|
|
Post by papa on Dec 31, 2017 21:55:34 GMT
OpenHAB sitemap Configuration Lines for the Cooking Controller In OpenHAB2's sitemaps folder, add these lines to your .sitemap file: Text item=Step_Node18 Text item=hoursLapsed18 Text item=Msg_Node18 Text item=Target_Node18 Text item=Temperature_Node18 ======================================== << click on pic for larger view ^^ sample from basicui display on screen Test Recipe, Step 1, Heating, held at targetTemp for 1 minute See this post about a HABpanel display of Cooking Controller data. Ahead, Seeing Results on the Arduino IDE Serial Monitor
|
|
|
Post by papa on Jan 1, 2018 20:24:05 GMT
Getting Serial Monitor Results from Your OpenHAB Connected Cooking Controller
Have your computer running a rightly configured OpenHAB server & running Mosquitto Broker service (MQTT). Have your programmed Gateway's Arduino / Ethernet shield connected to your Ethernet network (& OpenHAB via MQTT) & wall powered. Have your RFM69 Cooking Controller connected to your computer's USB, with the sketch using debug mode, & with Arduino IDE serial monitor running at same baud as set in the Gateway sketch (115200). << Click on pic for larger view. ^^ With all in the previous paragraph, you want the serial monitor to show results like this pic annotated in red, indicating the end node is connected & transmitting data to the Gateway / OpenHAB. Ahead, The Cooking Controller Inside Its Enclosure
|
|
|
Post by papa on Jan 1, 2018 20:36:47 GMT
The Cooking Controller Inside An EnclosureEarlier in this thread, I provided some alternative parts to buy for putting the Cooking Controller inside an enclosure that would protect the electronics & protect people from mains voltages. As shown below, I have made the Cooking Enclosure in a project box & have made a batch of yogurt with it. << Members, click on pics for larger view ^^ Some inner contents ^^ Outside of Project Box Notes: I used electrical tape to cover the DC & AC terminals of the solid state relay so they would not short against the AC outlet or the bottom of the Buono Uno Arduino compatible. I also protected the AC outlet terminals with electrical tape. To make mounting holes in the project box, I used a drill press & a jig saw. A small hole saw attachment on the drill made the hole for the piezo speaker.
|
|
|
Post by papa on Jan 6, 2018 16:56:10 GMT
The Cooking Controller, A Study in Power Usage
Sometimes we wonder if our Arduino compatibles can supply enough power for all we want to do with them. I use a Buono Uno Arduino compatible whose current supply is fairly robust compared to other compatibles, but starting this project, I still had concerns.
A number of things consume power on the Cooking Controller. The push button & potentiometer use 3.3 volts during brief input periods. The piezo speaker uses 3.3 volts for however many minutes are stipulated or until the button is pushed. The heat sensor uses 3.3 volts once per second. The RFM69 radio (a high power version) uses 3.3 volts once a minute. The LCD uses 5 volts constantly. The solid state relay uses 5 volts when the program sketch calls for heat.
The biggest power draw is probably while the LCD, relay, RFM69 radio, & heat sensor are on at the same time.
The only power concern I saw during testing was occasional dimming of the LCD back light. So in the Cooking Controller sketch, at the beginning of the txRadio() function (transmit radio data), I put the line
digitalWrite(relayPin, LOW); // Before transmitting, turn off relay to decrease competition for power.
After that addition, I noticed no signs of power fluctuations.
|
|
|
Post by papa on Mar 31, 2018 20:44:35 GMT
Improvements in the Cooking Controller Sketch
I previously provided an RFM21 version of the Cooking Controller sketch that is improved from earlier.
This sketch works with the same schematic above. I updated customizing instructions above for the new sketch.
The improved cooking controller will now work with RFM69 radio code included, with or without radio connection to a gateway. Without radio connection, the LCD will not show updates for about the first 5 of 60 seconds.
When radio transmission fails, the controller will disable it & then try to re-enable it every 0 of 60 seconds. When radio transmission is succeeding, a "T" shows at the LCD's right side. Failing transmission displays "-" instead of "T"
When the cooking controller is activating the relay for the cooker to heat, an "H" shows at the LCD's right side. With heat off, a "-" displays.
As HH:MM:SS, the LCD also displays either Total time since execution started OR how long the current targetTemp is Holding.
Earlier, the sketch sent OpenHAB the current temperature only at the start of a step & when the controller was holding at a targetTemp. Now the sketch also sends the current temp as it works toward the targetTemp.
|
|
|
Post by papa on Jan 15, 2019 16:10:10 GMT
More Improvements in the Cooking Controller Sketch
In this post, I provided a new RFM22 version of the Cooking Controller sketch that is improved from earlier.
This sketch works with the same schematic & customizing instructions above.
This version has somewhat significant cosmetic changes in the LCD display of the cooking steps. Previously, the display of the H & - for heat on or off would show & remain in wrong positions. More seriously, if the holding time went longer than 9 hours & 24 minutes, it started showing negative numbers that counted down instead of up. I was already using unsigned long values for time stamps. However, in the timePrint function, I had used integer values which reached roll over. Now in the timePrint function, I use unsigned long values. When I just tested the yogurt recipe, I was glad to see that "Holding" successfully passed 9:24:00 without corrupting & worked fine through the recipe-set 12 hours. Caution: However for this test, the controller did not stop at 12 hours, but so far is past 18 hours. So we may need to manually stop the cooker at 12 hours. The good news is that the controller may work for recipe steps of many hours.
I'm storing in EEPROM & retrieving the time to hold the temperature. I wonder if that area is getting corrupted. I'll move storage to a new EEPROM area. Then the next time I test the yogurt recipe, I will post whether it stopped at 12 hours.
|
|
|
Post by papa on Feb 9, 2019 20:02:42 GMT
Using the Embedded MQTT Broker & MQTT 2.xx Binding Start here for installing the Embedded MQTT Broker & MQTT 2.xx Binding Create/Install a Thing for the MQTT 2.xx Binding, embedded mqtt brokerGo to PaperUI\Inbox\MQTT Binding\Search Manually Add. Click the ">" at right of Generic Configure the Generic MQTT Thing using the following fields: Name [starts as Generic MQTT Thing] Node18 << This is the RFM69 Node to be accessed. Thing ID xxxxxxxx [ randomly generated by OpenHAB ?? ] Location yyyyyy [optional physical location you supply ?? ] Bridge Selection MQTT Broker - mqtt:systemBroker:embedded-mqtt-broker
Continues ...
|
|
|
Post by papa on Feb 9, 2019 20:12:38 GMT
Using the Embedded MQTT Broker & MQTT 2.xx Binding Create a MQTT 2.xx Channel via PaperUIGo to PaperUI\Configuration\Things\Node18 To Add a Channel, click on the "+" in a blue disc beside "Channels" In the Add Channel Window, fill the fields:Channel type Text Value < choose type according to the item data type we want Channel id Node18Channel02 < arbitrary ? as long as we match the id in a linked item later Label Node18_RSSI < arbitrary ? MQTT State Topic home/rfm_gw/nb/node18/dev02Note: In this case (unlike a switch), there is no "command topic." When I needed a command topic for a channel, it worked to use the same topic as for the state topic, except change "nb" to "sb" MQTT 2.xx item for the Cooker.items file String Node18RSSI "Node18rssi (db)[%s]" <network> (Nodes) { channel="mqtt:embedded-mqtt-broker:topic:mything:Node18Channel02" }
Continues ...
|
|