Automating Industries

The Project
The Project
Fires in Industries have the most devastating effects. Just due to a flammable gas and a spark, a fire can occur causing a huge damage.
Also now its necessary to monitor the status of the industry from anywhere. Be it home, for fire or police department or anywhere. I have an idea and that is to monitor the gases of these industries and also we can control exhaust or temperature to evacuate the gases or bring them to non-reactive state.
To get these readings from anywhere I plan to use MKR Wifi 1010 board which has WiFi as most of the industries nowadays do have a decent WiFi and so the data can be sent over to a server and also read. Also to control the exhaust fans and AC or any such atmosphere or something else I plan to use CAN shield. Although I don't know much about it  I had found out that most of the instruments in refining or manufacturing industries use CAN Interface only! We can also detect motion going on at some places and of course Temp, Humidity and Air pressure...
I also want the connected machines/devices to be controlled via web and the Conditions changing based on the phase of operation making it great and easy for automated operation of the machines...
Hardware Required:
  • MKR WiFi 1010 // Main MCU
  • CAN Shield // to control other industry grade devices
  • BME280 // i2c sensor to detect temperature, humidity and air pressure
  • Grove eCO2 and VOC sensor // for some gases
  • Grove Multichannel Gas Sensor // for some gases
  • MKR Connector Carrier // for less dirty wiring
  • LiPo Battery or PowerBank // for Power
Hardware for making your own CAN device:
  • Arduino compatible board // any one Uno, Nano, Leonardo, even NodeMCU
  • A Motor and FAN
  • MOSFET(any one will work) // N channel
  • MCP2515 CAN module // any other compatible module may also work
Software to be used:
  • Arduino IDE // for programming //web editor //or offline
  • Node Red // for server side
  • Mosquitto MQTT // communication
Schematic/ Wiring:
notion image
All the Wiring is pretty simple, nothing like biological science!
This project works very simply but works good. Our goal is to solve the problems in the industries. To do that we need to moitor different conditions and control the devices according to that. We also want monitoring of that data on our smartphones and also send alert emails/sms. The sensors for this protoype are very basic (uses mentioned above) . This sensors will give us the data on which our server..<<The server is node-red running on a RPi Zero W also handeleing MQTT protocols>> will process it and give commands for the CAN Shield. All this system can help detect harmful gases like CO (very dangerous for humans) and flammable gases like H2 and some unwanted ones like VOCs and CO2 aso. The exhaust fans will be controlled in this way, and if it wents too high i.e., out of control, the owner will be alerted... Special services can also be called.
About the CAN device:
For a consumer use, I could not get any CAN device to hack upon, ofcource I cannot mod a real car, so I made my own little CAN device, with another CAN mosule (MCP2515) connected via SPI, a FAN (motor) , some Alert LEDs, and another Arduino(Leonardo) , which works great. It has its own commands which I sent from my project.
Microchip MCP2515 wiring
notion image
CS and INT pins can be changed by using CAN.setPins(cs, irq)INT pin is optional, it is only needed for receive callback mode. If INT pin is used, it must be interrupt capable via attachInterrupt(...). The code is on my GitHub Repo
The CAN device arrangement.
notion image
notion image
notion image
I had made a Project for Monitoring the Industries with fewer features and less powerful and less automated which I would like to repurpose with this. Helping it detect more gases more accurately use IR temperature sensors and more... The original project can be found here. The code is fairly starightforward, I have used the new Arduino's MQTT Library to send messages. Also the sensor readings was teaken by their respective libraries. I used the most basic CAN library specially for MKR Devices to communicate with the DIY CAN device. For sending the commands for Exhaust to the CAN device, I just simply, set some if statements to combine the bad conditions to one variable which will be sent to the CAN device, to operate Accordingly. The Code can be found in my GIthub Repo.
Note: All MKR Boards are having some issues for me in working with the offline editor. Its baud rate and an unusual MKR <board> package not found error. Even after removing and installing the latest and the previos build thrice it did not work, even on different computer. But the online Editor works very well and I used that to code for this project.
 The Online Editor in action
notion image
Some Pictures of the Setup
After Connecting all the things: MKR WiFi 1010, CAN shield and Grove Connector Carrier stacked with some wires for sensors and CAN and supply.
Server Part:
For the server side, I used my RPi Zero W and setup Mosquitto MQTT and Node-Red on it. Node-Red is a node JS based GUI for drag and drop commands and works really well for creating stuff quickly. I created a very simple Block code, for this purpose. You can though use any IOT service like Blynk or even Adafruit IO MQTT with some changes in code. The Import Sippet for Node-Red can be found in GitHub Repo.
View of my "Nodes"
notion image
My Dashboard View.
notion image
The Final Product:
This is my Final Arrangement with all things connected. (not a permanent setup but a working one)
notion image
notion image
The video of the working project:
This project turned out to b easier and better then what I antisipated, with the help of new boards!
It was the first time I had ever used any MKR board.
I got to learn a lot about the CAN Bus and its working. I could even get information about the topic from a Lift Engineer and how they use it to control so many LED panels and controller boards.
There is a major problem while using the Grove multichannel Gas Sensor and that is it takes a lot of time in heating up, even on 5V rail, this causes the MQTT gateway to shutdown ,while measuring the values. Althought this problem is only observed when the room temperature is quite cold. It dod notwork for me in my home when temps were around 20C. But it works outside, in sunlight and in warm areas (most industries have warm emperatures after all) or heated rooms.
The MKR boards are quite ready to directly convert any project from a prototype phase to an induustry grade solution.
The Arduino team just needsa to fix some issues which many people got in after the newsest releasse in programming the board.