Arduino

master
javadoc

The Arduino service is used to communicate and control the very popular Arduino micro-controller. MyRobotLab runs on a computer and controls the Arduin hardware through a serial port.

The Arduino needs to be loaded with an Arduino sketch called MRLComm. The latest can be found at the end of this page.

This sketch allows commands from MyRobotLab to be processed on the Arduino hardare, it also allows the Arduino the capability to send data back to MyRobotLab (MRL).

This sketch only has to be loaded once on the Arduino.  The only time it would need to be re-loaded is when it needs to be updated.  After you load the Arduino sketch you may connect (MRL) with the Arduino through the appropriate communication port.  If the Arduino sketch is up to date, you'll see a message after connecting (goodtimes)

<<picture goodtimes>>

If your Arduino sketch it out of date it should say which version it is expecting.  

<<picture out of sync>>

Simply, load the latest MRLComm sketch to fix.

Once MRL is connected to the Arduino, it allows all the many other Services to interact with the Arduino.

  • You can use Arduino as a simple type of oscilliscope
  • You can use Python to effectively program the Arduino, turn on off or read pin values, interact with sensors, control servos, etc.
  • MRL can control and communicate with many Arduinos, there is no limit
  • MRL can be used to communicate between Arduinos
  • With MRL's WebGUI service you can very quickly and easily setup a web interface for an Arduino.
  • With MRL's Sphinx service you can control and Arduino with speech recognition.

<<video demostration>>

<<TODO - hyperlink all oher services>>

<<sketch at bottom>>

<<library at bottom>>

Additonally if you are experienced with Arduino or interested in integrating rather than replacing one of your sketches with MRL, you can use the MRLComm library.  

<<how to load mrcomm library link>>

The GUI view to this service has two sub panels.  It has a Pins Panel, and an Oscope.  

<<oscope>>

You should be at least somewhat familiar with Arduino setup and programming.  See the Arduino website for more information. The Arduino must be connected to your computer when MyRobotLab starts.

In the MRL tab, start the arduino service by right clicking it and selecting start.  Name it anything you like.  Open the Arduino service tab by clicking it.

Editor Menu Bar:

Editor Icon Bar:

Sub Panels:

Pins:

 

Oscope:


#file : toSort/Arduino.analog.input.py edit raw
# getting analog input back from arduino into Python

arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM15")

readAnalogPin = 1
readDigitalPin = 7

# make friendly sample rate
# arduino.setSampleRate(8000)

# add call back route
arduino.addListener("publishPin", "python", "publishPin")

# my call-back
def publishPin(pin):
  print pin.pin, pin.value, pin.type, pin.source

# get data from analog pin for 5 seconds
arduino.arduino.enablePin(readAnalogPin)
sleep(5)
arduino.arduino.disablePin(readAnalogPin)  

# get data from digital pin for 5 seconds
arduino.enablePin(readDigitalPin)
sleep(5)
arduino.digitalReadPollingStop(readDigitalPin)  


 

eziovn123's picture

How can I control a servo

How can I control a servo through analog pins ?