PID Control for BBQ Bot

by Stephen LEE in Circuits > Raspberry Pi

11592 Views, 91 Favorites, 0 Comments

PID Control for BBQ Bot

586d097e8ae43b20e6000315.jpeg
Screenshot 2017-01-03 10.04.34.png
PID Control For BBQ Bot
Cover.png
58708d198080cf0cfe000e75.jpeg
5881d55f8080cf0cfe004d0c.jpeg
586d0854ef665a79cd000133.jpeg
02Graph_BBQsmokerBot.jpeg
Graph_BBQsmokerBot.jpeg
Screenshot 2016-12-20 22.48.38.png
Screenshot 2017-01-06 18.50.23.png

Introduction

The secret is in the smart BBQ smoker. It could do to turn the finicky art of smoking meat into a controlled, semiautomated science. It uses a node-RED of PID (proportional-integral-derivative) controller , a Raspberry Pi2 with ESP8266-01, and a fan to regulate its own temperature & humidity, automatically producing an ideal slow-and-low burn. The science of smoke indirect heat cooks the brisket “slow and low,” providing enzymes the optimal amount of time to turn tough collagen into melt-in-your-mouth gelatin. Wood adds flavor during the first few hours: Its lignins denature as it burns, releasing tasty smoky compounds.

MQTT(Message Queueing Telemetry Transport) is a Machine-To-Machine(M2M) or Internet of Things (IoT) connectivity protocol that was designed to be extremely lightweight and useful when low battery power consumption and low network bandwidth is at a premium. It was invented in 1999 by Dr. Andy Stanford-Clark and Arlen Nipper and is now an Oasis Standard.

https://www.oasis-open.org/news/announcements/mqtt-version-3-1-1-becomes-an-oasis-standard

- How to tune PID gains of Node-RED with MQTT on Raspberry Pi

https://www.instructables.com/id/PID-Control-for-CPU-Temperature-of-Raspberry-Pi/

- How to make a client of ESP8266-01 by Arduino IDE (By knolleary)

https://github.com/knolleary/pubsubclient

- How to use the Bluemix platform (Docs)

https://console.ng.bluemix.net/docs/

- ESP Chips(8266,32,8285,8095) Docs

https://espressif.com/en/support/download/documents

Table of Contents

Step 0: Introduction

Step 1: Table of Contents

Step 2: Bill of Materials

Step 3: Programming ESP8266-01 with DHT11 Sensor on Arduino IDE

Step 4: Programming NodeRED on Raspberry Pi2

Step 5: Setting up aluminum foil furnace with a circuited fan with Raspberry Pi

Step 6: Setting up MQTT v3.1 on Raspberry Pi2

Step 7: Checking your NodeRED codes with MQTT on Raspberry Pi2

Step 8: Adding & Setting up PID node, Dashboard on Raspberry Pi2

Step 9: Using a dashboard for PID control

Step 10: Tuning PID controller

Step 11: Download list

Step 12: List of references

Step 13: Version note

Bill of Materials

Programming ESP8266-01 With DHT11 Sensor on Arduino IDE

5881d632e02ad6f802001307.jpeg
586b0ab28852ddac5d0011fb.jpeg
Screenshot 2017-01-03 14.31.18.png
Screenshot 2017-01-03 13.48.52.png
586d0a9eef665a79cd00013e.jpeg
How to use Arduino IDE with ESP8266 Support
ESP8266 Arduino IDE HowTo

Reference: Arduino Client for MQTT By knolleary

https://github.com/knolleary/pubsubclient

I used a little bit from the pubsubclient's code.

Programming NodeRED on Raspberry Pi2

5882fe238852dd646f004b3d.jpeg
5881d1258852ddb2ec001a04.jpeg

How to start Node-RED on web-browser.

(1) Write down command shown below to a terminal window.

node-red-start

(2) You can find an IP address as below. 'Once Node-RED has started, point a browser at http://169.254.170.40:1880' (It depends on your IP address)

(3) Open your web browser.

(4) Copy the IP address and paste on web-browser.

(5) It will display a visual editor of Node-RED on web-browser.

(6) You can start coding with visual editor on web-browser.

(7) Try dragging & dropping any node from the left-hand side to right-hand side. It's really easy to code. ( You can conveniently use the visual editor offline as well as online. ) Download the '__ver0.1.txt' file. (1) Click the number (1) at the right-hand side corner shown in NodeRED on web-browser. (2) Click the Import button on the drop down menu. (3) Open the Clipboard shown in the above 1st picture. (4) Lastly, paste the given JSON format text of '____ver0.1.txt' in Import nodes editor.

Setting Up Aluminum Foil Furnace With a Circuited Fan With Raspberry Pi

5869fd0f65d221290a000808.jpeg
5869fdcd8ae43be54f000226.jpeg
586d0c543dd33a4de0000337.jpeg
586a1235e02ad6ffcf003fc7.jpeg
586b27cb8080cfd3d7003115.jpeg
586b28e49bad4baa540019e0.jpeg
586adf1465d221290a000c8e.jpeg

Setting Up MQTT V3.1 on Raspberry Pi2

588300298ae43b82f0003896.jpeg
5881cbe88080cf0cfe004cd2.jpeg
58708e21ef665a25b4000ebf.jpeg

There are two options such as using eclipse paho, installing a mosquitto sever. Also, you can use (1) option instead of (2) opption.

(1) Using "iot.eclipse.org".
Click each MQTT node and Type it.

 iot.eclipse.org

(2) Setting up MQTT v3.1 on Raspberry Pi2
This message broker(Mosquitto) is supported by MQTT v3.1 and it is easily installed on the Raspberry Pi and somewhat less easy to configure. Next we step through installing and configuring the Mosquitto broker. We are going to install & test the MQTT “mosquitto” on terminal window. Click that.

https://www.instructables.com/id/PID-Control-for-CPU-Temperature-of-Raspberry-Pi/

Checking Your NodeRED Codes With MQTT on Raspberry Pi2

580eed4f50e1b680f600145d.jpeg

When you will use the JSON format of the '_____ver0.1.txt' on Node-RED, it's automatically set up & coded each data. I have already set up the each data in each node.

(1) Click each node.

(2) Check information inside each node has been prefilled.

(3) Please don't change the set data. (The above can be customized for more advanced users.)

Adding & Setting Up PID Node, Dashboard on Raspberry Pi2

Screenshot 2016-12-31 17.06.38.png
Screenshot 2016-12-31 17.05.40.png
Screenshot 2016-12-31 17.06.08.png

Searching the Nodes

Node-RED comes with a core set of useful nodes, but there are a growing number of additional nodes available for installing from both the Node-RED project as well as the wider community. You can search for available nodes in the Node-RED library or on the npm repository .

  • For example, we are going to search 'node-red-node-pidcontrol' at the npm web. Click here .
  • Then, we are going to install npm package, node-red-node-pidcontrol, node-red-dashboard on Raspberry Pi.

To add additional nodes you must first install the npm tool, as it is not included in the default installation. The following commands install npm and then upgrade it to the latest 2.x version.

sudo apt-get update
sudo apt-get install npm
sudo npm install -g npm@2.x
hash -r
cd /home/pi/.node-red
  • For example, 'npm install node-red-{example node name}'
  • Copy the 'npm install node-red-node-pidcontrol' from the npm web. Paste it on a terminal window.
  • Ex: node-red-dashboard, and node-red-node-pidcontrol
npm install node-red-node-pidcontrol node-red-dashboard

You will need to restart Node-RED for it to pick-up the new nodes.

node-red-stop 
node-red-start

Close your web browser and reopen the web browser.

Using a Dashboard for PID Control

The dashboard is a visual UI tool like gauge, chart. There is a basic tutorial of a Node-RED dashboard using node-red-dashboard. http://developers.sensetecnic.com/article/a-node-red-dashboard-using-node-red-contrib-ui/

Tuning PID Controller

586a02e5e02ad6ffcf003f89.jpeg
5881cfc17a9cb6bb3e0025d6.jpeg

https://www.instructables.com/id/PID-Control-for-CPU-Temperature-of-Raspberry-Pi/

My instructable could be really helpful to tune the PID gains for your system.
This is big job to adjust the pid gains. Use my source(node red) from the Download List.

Download List

List of References

Version Note

-----------------------------------------------

Version rules

VerX.Y

  • X: Changed
  • Y: Added

(Ex 01) file__Ver0.2 : added something

(Ex 02) file__Ver1.0 : changed something

-----------------------------------------------

  • RapsberryPiServer_PID_Control_For_BBQ_Bot_ver0.2.txt : improved PID tuning (25 Dec 2016)
  • RapsberryPiServer_PID_Control_For_BBQ_Bot_ver0.3.txt : added UI dashboard (20 Jan 2017)