Introduction: Environmental Monitoring Rover - Powered by Intel Edison

This is a instructable inspired by the Mars Curiosity Rover , I don't expect this rover to make it to Mars !! but you mimic it and implement some cool features using the Intel Edison. Having said that ,on mother Earth you can find industrial applications for this, to monitor hazardous condition.

Here are some features implemented using

  • A modified toy truck, which will act as the rovers chassis
  • Using a python-flask web app running on Intel Edison to control the Motors on the rover
  • Using a web cam to stream video to the web app to check the rovers line of sight
  • Add sensors to monitor the environment variable (click the Sensor button for real time sensor values)
    • Temparature
    • Gas sensor
    • UV sensor
  • Upload Sensor data to the Intel cloud analytics for future reference, by clicking the PostIoT button in the web app

Step 1: Collecting Components Parts You'll Need

Here are the components you'll need

Electronic components

Tools and other material

  • Zip ties
  • Multimeter
  • Wall mount DC12V ~1.5A to connect to the Edison during setup
  • Mini USB cable to connect to the Edison
  • 3D printer and Filament(this is optional but I would suggest at-least to print the Motor Driver STL file for easy mounting and wiring )
  • machine screws(about 10 ) if you plan on printing the STL files attached in the steps below.

Step 2: Selecting a Chasis for the Rover

In my case, I am using the same toy monster truck as a chassis which I used on an older project.(the truck, retails for about 20$ at a superstores like Walmart etc). Here you can use any robotic chasis that would hold the Edison Arduino break out.

Remove the screws from the Monster truck and gently dis-assemble the parts.

Be careful and patient ! while getting the circuit board and the battery holder out to prevent it from damaging the battery holder.

Step 3: Test the Motors and Solder Wire to the Battery Pack(Optional)

Before you get to interesting bits below test to check if the DC motor are still functional , in my case I used a 4 AA battery holder to test both the motors as shown in the picture above.

Now desolder the circuit board using a soldering iron from the battery holder.

Once done add batteries to holder and do a quick voltage test using a multimeter as shown in the picture above, in my case the battery holder uses 5 AA batteries , which means a output voltage of about 8-8.5 Volts.

Solder some breadboarding wire to the two ends of the battery holder as shown in the picture above.

Note: This is an optional step, if you are using a rover kit of some kind,just ensure that the Intel Edison Arduino break out is mountable on the rover.

Step 4: 3D Print the STL to Hold Motor Driver to the Grove Shield (Optional)

Download the STL file attach and 3D print. It should take about 5-10 mins .This part attaches to the Grove Base Shield which is mounted on the Edison.

First using a zip tie, secure the Sparkfun motor driver to the 3D printed part.

Now connect the Grove Shield on the Intel Edison Arduino Base board.

Then screw the 3D printed part to the base shield as shown in the picture above with 4X40 machine screws.

Step 5: Preparing the Intel Edison - Flashing Yacto Linux Using Flash Tool Lite

Now to prepare you Edison download the latest version of the Yacto linux image from the Intel website at

https://software.intel.com/en-us/iot/hardware/edis...

While writing this instructable, the Yacto release version is - edison-image-ww25.5-15.

As part of this install as shown in the picture above we are going to use Flash Tool Lite tool instead of the old command line method which include the command (reboot ota) was used in one of my older instructable(Getting Started with Intel Edison - Python Programming)

You can find the manual to use the Phone Flash lite tool at

https://software.intel.com/en-us/articles/flash-to...

Tip : We are using the Phone Flash lite to flash Yatco so that we can make use of the ~900MB of space in the root partition , this will be handy as we will be installing a lot of packages and can use the space to store picture taken by the webcam.

Step 6: Configuring Intel Edison -WiFi and Password for SSH

Connect the Edison Arduino breakout as shown in the picture

  • basically connect the lower most USB port to the cable that will be connected to your computer. This is the Serial over USB port.
  • And connect another micro USB cable to the port which is closer to the switch. In this scenario this port will be used to power up the Intel Edison and the expansion board.

Now on your Mac, open the Terminal App

To get into the Edison via the Serial port use the following command screen/dev/tty.usbserial-A
and then hit the Tab key, this will populate the complete device name then type 115200 –L(in my case screen /dev/tty.usbserial-A402IDIL 115200 –L)

The Intel Edison has an Wifi chip on-board,so take advantage of it! if you have have a WiFi router at home..
To configure the Wifi on the Edison, type in the following command

configure_edison --wifi 

and hit the enter key It takes about 10 seconds for the Edison to scan for Wifi networks and list them as shown in the screen shot above. Type the number which matches with you WiFi router name , in my case "androidpod" is my network name which corresponds to 40 in the list

Type in your password, and once done make a note IP address and web url which in my case is http://edisonhub.local/. Bookmark the URL above as you will need this to know your IP address to SSH in.

To set a password for the Edison use

configure_edison --password

Once done using another terminal window, check if you are able to SSH in using

ssh root@ip-address-of-Edison

Now if you choose you can use ssh terminal or the screen terminal to setup the urls for the official packages repository for the Edison.

echo "src intel-iotdk http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/intel-iotdk.conf
 opkg update
 opkg upgrade

Now to complete the build you will also need the unofficial packages repository ,for this update the /etc/opkg/base-feeds.conf file, followed by the update command

vi /etc/opkg/base-feeds.conf

Then add the following line and !wq to save the file in vi editor

src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

the run an update

opkg update 

Note: Do not run "opkg upgrade" for the unofficial repo, this will unnecessarily eat up space in your root partition.

For more info refer to AlexT's blog at http://alextgalileo.altervista.org/edison-package-...

Step 7: Wiring Up the Intel Edison to the Sparkfun Motor Driver

Now for the wiring first connect the signal half of Sparkfun motor driver(TB6612FNG break out which is dual H-Bridge) to the base shield as shown in the first picture , here are the connections

  • STBY to pin 10 on the base shield which act as the Standby

To control back motor of the truck

  • PWMA to pin 3 - this is a PWM pin to control the speed of the motor
  • AIN1 to pin 9
  • AIN2 to pin 8 - both these pins decide the direction the back wheels will spin.

To control the front motor which provides direction to the truck

  • PWMB to pin 5
  • BIN1 to pin11
  • BIN2 to pin 12

Now insert/mount the board on your rover and complete the other side of the connections, that is

  • A01 to one terminal of the back motor as shown in the second picture above
  • A02 to the other terminal
  • B01 to one terminal of the front motor
  • B02 to the other terminal

Then to Power up the motor

  • Connect VCC to the battery +ve
  • and GND which to the GND of the battery back , here is where I use the Mini bread board to make a common ground connection to the Grove base shield

Tip: This is a pretty expensive piece of hardware so a suggestion here would be to use, zip ties to secure the board to the base. And also use electrical tape where ever necessary to prevent short circuits..

Step 8: Testing Motors a Basic Test With the Python Code

Now it time to test you rover/tuck motor and decide the direction the wheels are spinning.

Place you rover up side down and power it up using the 9V battery.

Download the code attached and upload the code to the Edison using a FTP tools like FileZilla/Winscp

And then run the following

Step 9: Installing Packages for the Flask Web App

To install flask for the web app we will use pip to install it, which means that we will have to install the python pip package first, use the following command once you have ssh'ed into the edison.

 opkg install python-pip

Now that pip is successful installed as shown in the screenshot above install flask

pip install flask

Tip: I prefer using vi editor, but if you new to Linux or like prefer the nano editor over Vi, which will make it easier to edit file, if you have to, using the following command to install nano

opkg install nano

Step 10: Testing the Flask Install

Using an editor(vi/nano) of your choice create a file and add the python code for a simple flask app, this will test if our flask installation was successful.

nano helloflask.py

Add the following lines of code

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello Intel Edison!"

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=800, debug=True)

Save the file using ctrl+X

and then at run the python file

python helloflask.py

Now test the app using you browser ,using the ipaddress of the Edison, as shown in the second picture above.

http://ip-address-of-Edison:800

Note: if you have forgotten/not made note of your ip address use the following command

ifconfig 

Step 11: Testing the Rover Using Flask Web App

At this point shutdown the intel Edison using and get it off the wall adapter and power it up using 9v battery.

shutdown -h now 

Download the zip file attached and upload it to the Intel Edison using an FTP tool like filezilla.

SSH into the Edison and navigate to the basicflaskController folder and then run the command

cd basicflaskController
python flaskController.py

Now use your smartphone/table to bring up the app using your Edison IP address followed by the port :800, which in my case is

http://192.168.0.24:800

Congratulations !! on getting this far, you can now use the web app to control the Truck/rover as shown in the Video above

Step 12: 3D Print the Part to Hold the Webcam and Mount It Using Zip Ties(Optional)

Now to add a line to sight to the rover we are going to add a UVC webcam to the USB port of your Edison.

3D printing the parts is optional here, if you can find other alternatives to secure the webcam to the rover.

If you plan to 3D print and have the same web camera, that is the Logitech HD Webcam C270, download the STL file and slice it and 3D print it. Based on your setting 3D printing should take about 15-20 mins.

Now snap the 3D printed part on the camera and using Zip ties secure it to the top of the rover.

Finally add the USB to the USB port of the Edison as show in the picture above.

Step 13: Installing Packages You Need to Run the Webcam

Now to use the webcam connected to the USB port, you will need the following modules/packages to be installed on the Edison.

Before you install the kernel modules, you will need to backup , increase and restore the boot partition, or you will run into the error as shown in first screen shot above.

Use the following command to back-increase and restore the boot partition, as shown in the second screen shot

mkdir /home/root/boot-backup 

cp -rp /boot/* /home/root/boot-backup/

umount /boot

mkfs.vfat -v -nboot -F16 /dev/mmcblk0p7

mount /boot 

cp -rp /home/root/boot-backup/* /boot 

rm -r /home/root/boot-backup

Now you good to go and install kernel modules , which will extend the kernel for USB devices

opkg install kernel-modules

Now type the following command to validate if your web cam is detected,

lsusb

in my case it shows up as "Logitech Inc, webcam C270 "

Note: Here see that you flip the switch near the USB connector toward the power input if your camera does not show up.

Step 14: Testing the Streaming From the Web Cam

Now to the fun part, streaming from the Intel Edison WebCam!!

For this you will need to install the mjpg_streamer package

opkg install mjpg-streamer

And then use the following command to test the stream

mjpg_streamer -i "input_uvc.so -y -n -f 30 -r 640x480" -o "output_http.so -p 8080 -n -w /www”

And then got to you browser on your laptop and type the following, and use should be able to see yourself on in the browser as shown in the picture above.

http://IPAddress-of-Edison:8080

which in my case is http://192.168.0.24:8080/?action=stream, if you just want to see the live stream.

Tip: If you plan on taking picture/selfies with the Edison using your web cam, install fswebcam

opkg install fswebcam

And then to take picture use

fswebcam testPicture.png

Step 15: Selecting the Grove Sensors to Add

Now to get to the environmental monitoring part, choose your sensors, here I choose the following sensors

Grove – Temperature × 1 sensor

Grove gas sensor MQ5

Grove - UV Sensor

Since I am using python-flask , I have converted the Arduino Library into the equivalent python library, which you can find in the next step.

Step 16: 3D Print the Holder to Mount the Grove Sensor

3D print the STL file attached. Here I have attached 2 STL files which should take about 10-15 mins to print base on the one you select

#1 - Sensor Holder V2- this is ideal if you are planing on select in the same set of sensor, and already has mounting holes

#2 - Basic Sensor Holder - this is a simpler version so that you can drill holes after 3D printing and mount the sensors of your choice.

Screw the sensor to the 3D printed base and using zip ties attach them to your rover.

Step 17: Testing the Grove Sensors

Connect the sensors to the base shield

  • Gas sensor MQ5 to A0
  • Temperature to A1
  • and UV Sensor to A2

If you prefer to test each of the sensor individually download the zip file attached and upload it to your Edison to test each sensor.

For example to get the temperature printed to the terminal use

python TemperatureSensorValues.py

Step 18: Using Intel IoT Cloud Analytics to Send Sensor Data

To take advantage for the Intel IoT Cloud Analytics, follow the steps to setup and test uploading sensor data to the cloud.

Follow the link below for a overview and setup steps

https://software.intel.com/en-us/intel-iot-platfor...

In our scenario, we need to setup two new sensor instance for the UV index sensor and Gas Sensor once you have setup your login at

https://dashboard.us.enableiot.com/ui/auth#/login

Basically the temperature is setup by default at My Account -> Catalog at the web site above.

Got to My Account -> Catalog and click on Add Catalog Item button, and add the following values, as shown in the first screen shot above

Add the following catalog item

  • Component name = UVIndex
  • Type = Sensor
  • Data Type = Number
  • Unit of Measure = mV
  • Format = Float
  • Display = Time Series

And on the same line add values from Gas Sensor

  • Component name = GasDensity
  • Type = Sensor Data
  • Type = Number
  • Unit of Measure = mV
  • Format = Float
  • Display = Time Series

And then SSH into your Edison and follow the link above to check date,testing network connectivity,changeing the device Id and activating the Intel Edison.

Now register the UV index and Gas Sensor

iotkit-admin register uvindex uvindex.v1.0
iotkit-admin register gasdensity gasdensity.v1.0

And to list the catalog item use the following command as shown in the screenshot above

iotkit-admin catalog

Now to test posting values to the Intel Cloud use

iotkit-admin observation uvindex 60
iotkit-admin observation temp 21

And once you post a couple of values you should be able to setup a graph in the My Charts section on the intel IoT website as shown in the 3rd screen shot above.

Step 19: 3D Print the Fake Solar Panels (optional)

Now to add looks! to your rover,3D print the fake solar panels STL file attached.3D the STL file should take about 10-15 mins based on your printer setting.

Then use a white paint pen to mark the groves in the 3D printed parts.

And then zip tie the 3D printed parts to the rover.

Step 20: Download the Code for the Monitoring App

Download the flask web app attached and upload it to the Edison using a FTP tool like filezilla.

SSH into the Edison and run the flaskcontroller.py file

python flaskController.py

This will start the flask web app, you are now ready to open the web app on your tablet/mobile web browser

http://IPAddressfEdison:800

Congratulation !! you are done and now ready to drive your rover around using the controller web app and take temperature,Gas density and UV index readings at real time by clicking the Sensor button, and also post the values to Intel's IoT Analytic cloud, for a graphical view as shown in the screen shot above ..

Github link for the latest revisions to the code.

https://github.com/CJAndrade/Environmental-Monitor...

Step 21: Rovers Future Enhancement

Here are some planned few future enhancements for the rover

  • Reduce the form factor using Intel Edison blocks from Sparkfun
  • Add some more interesting sensors like the Air Quality sensor
  • Add GPS to track the routes taken by the rover
  • And improve on the code, use openCV for spot detection(~something similar to face detection) as part of the flask app instead of mjpg-streams.
  • Power up the rover and Intel Edison with real solar panels , suggested by instructable members @GuthrieM1 and @VIVEK PRAKASHT

Please leave a comment below if you come up with some interesting suggestion..

Comments

author
Aneriah (author)2016-07-26

What is the total cost of everything that I need. I have literally none of any of the components. And I want to buy the cheapest parts possible. This includes all the software that I may have to buy. Also I would prefer it be in US dollars. Great design man, Its totally awesome.

author
CarmelitoAndrade (author)Aneriah2016-10-25

All the electronic components would cost about $180, given that you can modify an existing toy car, or you can also by a two motor robotic platform.In addition,all of the software used above is opensource.

author
Aneriah (author)CarmelitoAndrade2016-10-26

Okay. What if I bought a bunch of cheap sensors? Would they work just as well?

author
CarmelitoAndrade (author)Aneriah2016-10-26

Yes,it should ideally, but you may want to check on data sheet for the specific sensors before you buy..

author
Aneriah (author)2016-05-23

What is the total cost of everything that I need. I have literally none of any of the components. And I want to buy the cheapest parts possible. This includes all the software that I may have to buy. Also I would prefer it be in US dollars. Great design man, Its totally awesome.

author
AfshaanLondhe (author)2015-11-02

great project! I plan to make one with a raspberry pi

author

awesome, good luck , here is something similar I did with the Pi

https://www.instructables.com/id/Toy-Truck-Powered-by-Raspberry-Pi/

author
VIVEK PRAKASHT (author)2015-11-01

Really awesome..second the comment below to use real solar panel..I would say that this looks like the rover that Matt Demon drives to his extraction point in the movie Martian :)

author
SonikaJAnand (author)2015-10-27

Very Nice

author
eleman (author)2015-10-26

I must and I should make one. love it

author
GuthrieM1 (author)2015-10-22

This is totally cool! I must make one, but why did you not go with real solar panels? I know they are not simple but I would suggest it because it will give the rover even more possibilties, and allow it to operate without needing a charge.

author
ramithuh (author)2015-10-19

This is really neat! Have the intention of making this one day, but my Logitech quickcam doesn't support the Edison.. ?

author

Thanks , here is link that list of UVC webcam that should be supported by the Edison, https://en.wikipedia.org/wiki/List_of_USB_video_cl...

About This Instructable

8,721views

229favorites

License:

Bio: Born as a farmer , studied electronics ,working as a Consultant and a 3D printing enthusiast by night..
More by CarmelitoAndrade:BOSEbuild Speaker Beat CubeBOSEbuild Speaker Beats CubeIoT Globe
Add instructable to: