Monday, July 9, 2012

Obstacle distance sensor


Obstacle distance sensor is one of the most ground breaking projects which was undertaken by us in the
field of embedded system.

As we all know that world is analog, therefore analog computing is required more and more in some issues to bridge the gap between real time and tentative life.

In this project we have chosen arduino as our platform and atmega 328 as a microcontroller. We have used infrared sensors to detect existence of obstacle in front of robot and also to detect at what distance (in centimeters) the obstacle is detected .We have used interrupt timer in this project ,as the obstacle is detected ,the interrupt routine is executed. Once the interrupt routine gets executed, then first of all the distance is calculated out through another subroutine which defined inside it. After the distance is calculated the direction is determined out in which robot has to be moved and then accordingly the actuators are given control.

On the part of actuators we have used the theory of differential drive i.e. for example to turn sharp right left wheel will be rotated in forward direction and the right side motor is rotated in backward direction.

As a part of monitoring the distance of obstacle we have used serial communication between out robot and PC via IC RS 232.It can also be done by on board monitoring using LCD and send in the data to LCD.

In this entire project power supply used is of 5V in all the places except for motor IC, in which 12Vpower supply is used.



















Saturday, June 9, 2012

Arduino + Labview


   This is a quick (REALLY quick) writeup on establishing a connection between a custom designed Arduino Board using Atmega8 and LabVIEW.  I used a very simple setup where Arduino would receive data  serially  from LabVIEW. To demonstrate this I have used an example of RGB-colour gradient. This employs a simple 2-way communication, the Arduino would listen for a comma separated values of red, green and blue at the beginning of each iteration. If a command is heard, it would react by first parsing these values and then changing the color of the RGB LED, depending on the combination of red, green and blue color received. If nothing was heard, then it would continue on through the read cycle. The method is inefficient and barbaric, but my intent was proof-in-concept.  The concept may be improved upon to increase reliability and efficiency.



Step 1:  Quick Arduino Sketch

    The first thing we need to do is write a sketch for the Arduino, to prepare it for taking values from the serial port and parse it to ensure correct intensities are set for red, green and blue pins of the RGB led.. This is accomplished with a simple sketch that accepts comma separated values of red, green and blue and constantly transmits a message over the Serial comm. 




Step 2:  Let's do the Labview VI

    The trick in this step is more about the right serial data than anything else.  Below is a snapshot of the VI I threw together to connect to the Arduino.


























The Labview Vi creates a comma separated values of the colors and sends it to Arduino, which simply parses that string and does it's job. With that all wired together, save it as a VI named Arduino or something along those lines. Hypothetically you could set the baud rate as a constant 9600, but I left it changeable in case I feel crazy one day and want to spice up that rate a bit.

As a side note, the VI is a handy thing to be able to build, and when you establish a successful connection with the Arduino with reliable data flow and communication, I recommend wrapping the whole thing up as a VI so all you need to do is set the Baud Rate and Resource Name on input nodes and the output node will flow the raw data for you to do with whatever you want.

Step 3:  Now Look at the front-end to see if everything is perfect





Step 4:  Plug in the Arduino and turn it on

Plug in the Arduino and turn it on. Go to the Front Panel and select the appropriate VI resource name (which is hidden under the settings panel on my front panel) and flip the “On” switch.  If all goes well, on modifying the R, G and B values in the front-end above, the RGB Led would change color to the color shown in the front end. 

From here it is just a matter of using your new found connectivity to do something revolutionary.  Feel free to leave me any questions you might have.
You can get the code here