Ways to control Arduino – Javascript, Python and Internet

Posted by:

Preamble

There is always different ways to achieve the same goal. This is very true in programming, so is in life. Most times we like to think there is only one way – our way.

set up Arch Linux system for node and johnny-five etc.

This is a good tutorial for this subject and Arduino Experimenter’s Guide for NodeJS.

  1. install Arduino IDE for your system
  2. upload Firmata into board

    select-standardfirmata.jpg

  3. install node.js

  4. install npm

  5. switch on python for default (nmp install –python=python2.7 does NOT work) to install johnny-five

    Note: not a good practice since it will effect other packages, make sure reset to default after installation.

  6. mkdir for js files and link to johnny5 folder

  7. blink.js file

  8. run node blink.js

Bridging with Arduino via pySerial, pyFirmata or PyMata

  1. Install pyfirmata and/or PyMata

  2. with python via pyserial only Only serial strings can be passed with Serial.write and Serial.read. Customized sketch code required for advanced function, very powerful via pyhton GUI (esp PyQt), but required some serious coding from both end (python and Arduino sketch).
  3. with python via pyfirmata /or PyMata and pyerial Firmata needs to be loaded into Arduino. All the coding is from python end with PyFirmata framework. This is a very easy approach to control Arduino. Following code from PyFirmata

Control from the Internet with a web Interface

  1. Using Arduino Ethernet Shield Did not get a chance to try this way, and do not understand why spend $80 for a shield instead of $35 for a Raspberry PI with so much more to offer.
  2. Use Python CGI as gateway to web interface As shown in RLM site , with jQuery you are a true master of your Arduino and peripheral Hardwares. I will post some other project we did later.

    scn_pok_web.png

Firmata_test to quick test your system

  1. Download firmata_test from firmata.org, roll to bootom to get the righ version – 64 bit in my case

  2. The screenshot

    scr_firmata_test.png

0

Add a Comment