This is a very simple application of the Intel Edison based on the requirement of a monitoring system for the lab. With this I can leave the laboratory while checking from time to time that the temperature of a mixture is stable or keep the air contamination of the lab at a minimum by employing an extractor fan when the gas levels are dangerous, also turning off the source of said gas.
I made two implementations, one using websockets, jquery and express for a web app so that I can check it at home and another one that uses the Bot API from Telegram in order to check the status of the lab on the go. Since I've been unable to use both applications simultaneously, I will talk about the most useful one to me, the Telegram bot, and will update this 'ible in the future if I manage to make them work at the same time.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Tools and Materials
- Intel Edison with Arduino Expansion Board
- Bunch of groove sensors and actuators (IR temperature, air quality, relay, speaker)
- Groove Base Shield
Since I didn't receive the base shield, I had to solder one using dupont conectors and the arduino proto-shield. This is good on it's own, since now I can extend the cables pretty easily since I have a lot of male-female dupont cables.
Regarding the software tools, you'll need:
- A Telegram Client (Android, iOS, Desktop, terminal, web,...)
- Intel XDK IoT edition or your favourite editor for the Edison
- Node.js and some dependencies
Step 2: Set Up the Edison Board
The Getting Started guide from the Intel website is very straightforward, just follow the instructions and install the latest version of Yocto for Edison.
Step 3: Create a Telegram Bot
Making a bot for Telegram is a piece of cake, at least setting it up. This is done through, surprise, a bot! None other that the BotFather. Just look for this profile name on the search bar of your Telegram Client and follow the instructions it gives you in order to create your first bot. It's as simple as typing the profile name and name of the bot after using the /start and /newbot commands.
Once you have created it, BotFather will send you a token, an authentication code to safely use the bot that you will need later.
You can customize your bot to the point of even including personalized keyboards, just take a look around the Telegram developers website.
Step 4: Node.js and the Telegram API
In this program we use the node-telegram-bot package, a very simple to use tool that connects the Telegram API with the sensors and actuators through MRAA (which you should have installed already). To install this, use the following command on the terminal of the Edison (see the Getting Started Guide if you don't remember how to access the terminal):
npm install node-telegram-bot
You can see some examples on github. However, I haven't been able to send a file to the user due to some problem with the directories (error 34, ENOENT).
Step 5: Code
The other value you may need is your Telegram user ID and of those you want to authorize to use the bot. In this code it only serves to send a warning to all the lab users about a possible fumes outbreak, but you can quickly modify the program so that only those on the list can interact with the bot and no spies get the vital information of your temperature sensor!
This value can be obtained using the web version of the client and inspecting the profile of the user or with the terminal client. You can also deny this option by erasing the part in the code that mentions said values.
Step 6: Experiment!
Try to add your own sensors. It's pretty easy to do since there is a large amount of different sensors already in the mraa library and you can check example codes on the Intel website. I just used two sensors (temperature and air quality) because the rest I received weren't really fitting to this application. Only the flame sensor and the IR reflective sensor might have come handy. I couldn't use the Gas Sensor (MQ2) since it was defective and every time I tried to plug it into the board the Edison rebooted without really turning on again.
Further work that I need to do:
- Implement a webcam stream or at least snapshot by request. This was not possible because none of the three webcams I posses are compatible with the UVC drivers, which are used on the edi-cam.
- Include more sensors as a hall effect sensor or a functional gas sensor.
- Make the web app and the telegram bot script compatible. I'm more into python, so Node.js is quite strange for me yet. I hope I can make an application that works on different threads so as to avoid blocking one of the processes with the other.
Many thanks to Intel and Instructables for giving me the oportunity to participate on the IoT Invitational Contest. I wanted to make a bigger project, but even with the time extensions, personal issues have kept me from advancing the project much further.
Participated in the
Intel® IoT Invitational