Introduction: Beginners Video Tutorial Series for IoT With Intel Edison ( IntelIot)
About a month back I had the opportunity to be part of IoT road show being organized by Intel in Pune, India. It was an amazing experience. I wanted to build an IoT controlled RC car with few features. Having worked with Arduino, getting started was easy. But rest was difficult. Constant loss of WiFi signal and not so deep knowledge about the techniques in IoT technologies did not help me to create a great demo. Though I completed the demo and won best video presentation and a Basis Peak watch from Intel, the experience was hardly satisfactory. I wanted more. After coming back from Pune, I started digging down various technologies and options with Edison.
I realized that though there are several isolated tutorials in Edison, a complete learner series is missing. Where to start, what to start, what next to learn was difficult. So I decided to document my learning as part of videos.
The idea was that I must have enough resources so that if anybody tries to get started, he wouldn't have to spend that much time in internet. As a personal choice I find video tutorials to be more complete than web articles ( just my personal preference).
So I have created several how to do guides in Intel Edison along with some simple projects. As my process of learning has just began, I expect to learn more and therefore this Instructables would be updated as and when I learn anything new on Intel Edison.
If might just help someone looking for some basic insights and easy learning process.
Step 1: Getting Started With Arduino IDE in Intel Edison
In this tutorial we shall also learn the basics of Grove modules, what the pins are and how to use them. This is more of quick start feel good tutorial.
Step 2: Tip to Make Arduino Sketch Run at Startup
Edison does not start your Arduino sketch automatically. After you upload the sketch, it is basically a executable which is saved in /sketch/sketch.elf . Each time you reboot, you need to manually run this file. With following workaround you can run the sketch from start.
create a file by name startsketch.sh
vi startsketch.sh
then paste following content
#!/bin/sh exec /sketch/sketch.elf
/dev/ttygc0 /dev/ttygc0
:esc wq enter
mv /startsketch.sh /etc/init.d/
/ at the end is imp
chmod +x /etc/init.d/startsketch.sh
update-rc.d startsketch.sh defaults
That's all reboot and each time you start edison, Arduino sketch will start automatically.
Step 3: Adding Input to Your Control. LED and Button
This is another Basic tutorial with Simple Hardware. Here I have tried to elaborate coding logic for input driven control. How to make control decision based on state of buttons.
Step 4: Mini Project: Temperature Display in LCD and Alarm System
Previous two tutorials were extremely basic foundations. Having learnt some Arduino programming basics and hardware, we will now put that knowledge into creating a simple high temperature alarm system. In the process we will also learn how to find external libraries for your hardware, working with I2C and LCD basics.
Step 5: IoT With Edison: WiFi, Curl, ThingSpeak and Data Logging
So far we have got ourselves comfortable with hardware and Arduino programming. But We did not configure our device to Internet. In this tutorial we learn how to connect Edison to internet, how to login to the device from multiple putty windows using WiFi, how to use command line remote http calls using curl. We then extend this to make a simple data logging project where we log the data in sdcard and as well as in ThingSpeak.
Step 6: MQTT
MQTT is a light weight Machine to Machine communication protocol that makes remote control and simple data exchange efficient. You can control devices through web, windows, Mobile and everywhere.
We conclude this tutorial with a simple Mini project where we control LED with our mobile.
Step 7: Setting Up Node Red
Node Red is a visual programming tool by IBM. This makes your IoT programming extremely easy with drag and drop nodes. This is a javascript based interface. However working with all the capabilities need some more packages. This is just an installation guide for node red and other associated modules you need to start with node red programming.
Step 8: Node Red Programming a Complete Walkthrough
In this tutorial I have tried to cover all important building blocks in node-red tool. Input, output, GPIO, functions, Social integration.
We have transmitted our data to Gmail and Twitter, written processing blocks to consume command from twitter.
As a mini project, we have controlled On-Board LED from Twitter.Analog read and thresholding is another aspect which is covered here.
Step 9: Working With Bluetooth in Edison From Node Red and Node.js
Will Upload video Soon!
1) Unblock Bluetooth:
rfkill unblock bluetooth
2) Login to Bluetooth Console bluetoothctl
3) Make discoverable discoverable on
4) scan the device: scan on
5) once the device is seen in list, ctrl+c
6) pair
7) connect
8) trust
9) Download Android bluetooth SPP app
https://play.google.com/store/apps/details?id=mob...
10) Now we need to follow an Intel Tutorial Here:==> https://play.google.com/store/apps/details?id=mob...
a) download :https://software.intel.com/sites/default/files/managed/6c/16/bluetooth-service.tar.gz
b) using WinScp to upload the file to /home/root
c) untar the package
mkdir /home/root/bluetooth
cd /home/root/bluetooth
mv /home/root/bluetooth-service.tar.gz ./
tar -xvf bluetooth-service.tar.gz
d) Prepare for Bluetooth at startup
cp bluetooth-spp-pin.service /lib/systemd/system
e) systemctl enable bluetooth-spp-pin
f) reboot
g) after login back:
systemctl status bluetooth-spp-pin
11) This package has a file by name bluetooth-spp-service.py which runs serial port service and release them in a named pipe: /tmp/arduino_pipe_out So now we need to write a bash script that can read from this named pipe 12)
vi readPipe.sh
#!/bin/bash
pipe=/tmp/arduino_pipe_out
trap "rm -f $pipe" EXIT
if [[ ! -p $pipe ]]; then mkfifo $pipe fi
while true do if read line <$pipe; then
if [[ "$line" == 'quit' ]]; then
break fi
echo $line
fi done
echo "Reader exiting"
13) Make it Executable
chmod 755 readFile.sh
14) ./readFile.sh
It will now wait for a bluetooth command. From your app, generate bluetooth command You will see that is appearing in the command prompt
15) javascript does not support pipes. So we need to release it using websocket
16) Download websocketd a command based websocket deamon https://github.com/joewalnes/websocketd/releases/...
17) Unzip. copy the file websocketd to /home/root
18) chmod 755 websocketd
19) run the deamon ./websocketd --port=8080 ./readPipe.sh
20) Now go to your node red from input take websocket
Type: Listen On
Path: /ws://localhost:8080
20) Connect it to debugger ie it.!!!