I would like to show you how to connect Intel Edison with Arduino Kit and some sensor connected to the Grove board that comes with the Grove starter Kit.
FIRST, please setup the Intel Edison Board. I have gone through all the process step by step from the official page of Intel Edison board here. It is not more than 15 minutes process, but is very important. Also there you will learn all the basics that you need to know about this devices as well as how to assemble it and which port is used for what.
The Interesting Part:
- After you go through all the steps and setup the device and connect it to the WIFI, please open the Intel XDK Platform.
- You have to select the desired device from the drop down list as showed bellow:
If your device is not found, please insert “Rescan”.
3. After your device is listed, insert it and another screen like this bellow is showed:
You can populate your data and insert the “Connect” button.
4. You will see a connected message and also the Intel XDK IoT tab will look something like this:
This means that your software (Intel XDK) is connected to the device and you can download source code to the device directly with the buttons above. You can play if you want, but we are not going to use this code redactor since it is for Node.js. We only will be use the SSH Terminal TAB (You can use any other software like Putty or etc, but for beginners stick to this software because it is interesting and all in one platform for programming your device with Node.js).
5. Open the SSH Terminal tab and hit the “Connect” button down.
Now you are connected!
6. Before we can send data to the Cayenne, we have to install the cayenne-mqtt library with this command:
pip install cayenne-mqtt
7. After that I will use “nano” to create and edit my file. I do it with this command:
This will open an empty file and you can paste this code:
import cayenne.client import time from upm import pyupm_grove as grove MQTT_USERNAME = "USERNAME" MQTT_PASSWORD = "PASSWORD" MQTT_CLIENT_ID = "CLIENTID" client = cayenne.client.CayenneMQTTClient() client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID) #I have connected my temp sensor from the Grove Kit on Analog Pin 1, but you can chose from 0-3 temp = grove.GroveTemp(1) # this is the pin number! while True: client.loop() celsius = temp.value() time.sleep(1) client.celsiusWrite(1, celsius) time.sleep(5)
Don’t forget to populate your credentials in the code. To get them you have to go to the dashboard, click Add New - > Device Widget -> Bring Your Own Device. There you will find the Username, Password and ID.
You have to save using “Ctr + X” and then “Enter”.
8. You have to run the script using the following command:
9. After running the command, open the dashboard, and you can see the new device added on the left. Click on it and the temp widget should be automatically added!
Enjoy adding the other sensors from the KIT using the same logic