Coder Social home page Coder Social logo

janishd / lightrobot Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 184 KB

The LightRobot is a arduino and 3PI-Robot based moving light source. The Robot is fully controlled with an Android app. Android-App can be found here: https://github.com/janisHD/LightRobotRemoteControl-App A video that illustrates the functionality can be found here: http://www.youtube.com/watch?v=hJi5qhOgbXw

C++ 95.01% Arduino 4.99%

lightrobot's Introduction

Readme file for the LightRobot Software

The counterpart, the Android app can be found here:
https://github.com/janisHD/LightRobotRemoteControl-App

A video which shows the functionality of the robot can be found here:
http://www.youtube.com/watch?v=hJi5qhOgbXw


The aim of this project is to control a modified 3pi pololu robot using Android's voice controls and accelerometer.
Motivation was to learn some android and arduino programming, as well as having a cool moving lightsource at home :-)

We added 3 RGB LEDs on top of the robot, a bluetooth chip(rn42) and a sonar sensor(srf02) on the front, in order to avoid obstacles when 
moving randomly. 
As you can see in the demo video [0], it is possible to adjust manually the color settings with the android app, and activate a blink or shine mode.
Also, shining and blinkin in random colors is possible. Regardins voice controls, you can command "shine + color", "blink + color" and "move random", where color are "red, blue and green".
To control the speed and the direction of the robot, we rely on the accelerometer of the smartphones sensor.
More information is on the specific readme files of each part.

[0] http://www.youtube.com/watch?v=hJi5qhOgbXw


The software is arduino based and uses a few external libs as well.
To compile it the following libraries should be in the lib directory of Arduino:
-> 3PI-Robot lib ("Orangutan"): http://www.pololu.com/docs/0J17/5
   Download the most recent lib and add the libs OrangutanDigital, OrangutanMotors, OrangutanPushbuttons, OrangutanResources
   to the arduino libs (ide -> sketch -> libraries -> add library -> select folder)
   
-> TimedAction lib: http://arduino.cc/playground/Code/TimedAction
   Change the "WProgramm.h" to "Arduino.h" (see documented changes in project home)
   Add to the arduino libs

A schematic how the different parts should be wired is included.

The Bluetooth module is connected using the hardware serial port which out wired on the central port of the robot (PD0 and PD1).

To connect the Lights and the Range-Sensor a software I2C solution is used.
The LCD-Panel is removed and the available ports PD2 and PD4 are used for the software I2C bus.

After starting the robot the software is in the init state. Using Button A and Button B one can switch to the REMOTE-Mode or the MANUAL-Mode. 

In the REMOTE-Mode the robot is controlled with the Android-App

The MANUAL-Mode has been used for debuging purpose and does not a have a useful functionality.

A few words to the software architecture:

Statemanager:

The central point of the software is the statemanger. To understand the code this is the best starting point.

The state machine which is implemeted in this class acquires the input data from the Bluetooth-Module, the Range-Sensor and the hardware buttons. According to the current state theses inputs are routed to the actuators like the motors, the lights and lcd-panel (if in use).


TimedAction:

To save as much processing power as possible but update the input and output as often as needed the TimedAction library is used. Each input and output entity (for example Bluetooth-Module, the lights, the motors, etc.) have their own class, but inherit from the TimeEvent(do not mistake it for TimedAction) class. Every TimeEvent has a central function which executes the main task of this entitiy.
For example getting the bluetooth data or setting the lights to a current colour.

This function is registered as the callback hook in the TimedAction and gives simple mechanism to control how often a input or output part is updated.
For Example the motors must only be uptdated approximately every 100ms and the lights even less often. This saves a lot of processing time!

In the lightrobot.ino file every registerd callback can be viewed with the assigned times periods.


lightrobot's People

Contributors

janishd avatar mees avatar

Stargazers

Lorena Bassani avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.