Arduino Communications

From Combustory
(Difference between revisions)
Jump to: navigation, search
Line 9: Line 9:
 
'''Note: I owe a BIG debt of gratitude to all the Arduino developers that provided me with the tools/code/knowledge to allow this solution'''
 
'''Note: I owe a BIG debt of gratitude to all the Arduino developers that provided me with the tools/code/knowledge to allow this solution'''
  
== Functional Description of the Communications Method ==
+
== Functional Description ==
  
 
This method creates a log file that is created by an Arduino board using serial communications that is sent to a terminal which is redirected to a file.  The file can then be used by any software you desire to process the messages from the Arduino board. To send messages to the Arduino board the use of Arduino-Serial (a command line utility) is placed in a BASH script that is used to constantly poll for the existence of a command file.  When a command file is found, the BASH script will send the commands in the file to the Arduino board.  The response by the Arduino is to follow the command input and print response data out to the terminal, which is sent to the log file.
 
This method creates a log file that is created by an Arduino board using serial communications that is sent to a terminal which is redirected to a file.  The file can then be used by any software you desire to process the messages from the Arduino board. To send messages to the Arduino board the use of Arduino-Serial (a command line utility) is placed in a BASH script that is used to constantly poll for the existence of a command file.  When a command file is found, the BASH script will send the commands in the file to the Arduino board.  The response by the Arduino is to follow the command input and print response data out to the terminal, which is sent to the log file.

Revision as of 18:25, 5 August 2008

Arduino Communications Page

Contents

Summary

In my search for ways to communicate with the Arduino board, I found lots of ways that required me to learn new languages or learn serial communication programming. I do want to eventually pick up these skills, but I found a quicker way for my needs. I have learned over time that you can always find a better way to solve a problem, but I realize that the amount of time to learn that better way is sometimes greater than the project time-frame, and therefore just solve it in the best way you can with the tools you have. I believe that the solution below encompasses that spirit. Here you will find a quick, dirty yet effective solution for communicating with the Arduino.

This solution met my goals, but it may not meet yours. It is limited in the effect that a transfer in a message may take as long as 5 sec. This fits fine for my needs where I am just looking to form a distributed network of smart sensors/controllers that allow the setting of certain variables and the reporting of alarms and/or useful tracking information from the individual controllers.

Note: I owe a BIG debt of gratitude to all the Arduino developers that provided me with the tools/code/knowledge to allow this solution

Functional Description

This method creates a log file that is created by an Arduino board using serial communications that is sent to a terminal which is redirected to a file. The file can then be used by any software you desire to process the messages from the Arduino board. To send messages to the Arduino board the use of Arduino-Serial (a command line utility) is placed in a BASH script that is used to constantly poll for the existence of a command file. When a command file is found, the BASH script will send the commands in the file to the Arduino board. The response by the Arduino is to follow the command input and print response data out to the terminal, which is sent to the log file.

If your brain just got scrambled, join the club. There were several technical hurdles I was concerned about of as soon as I thought of it. I did not even think this would work at first, but it turns out to function just fine. (Until Further Notice! `,~)

Requirements

The method requires the following hardware/knowledge:

  • An Arduino Board or equivalent
  • Linux computer that is able to communicate with the Arduino
  • Your favorite development language
  • Basic Linux operational skill
  • Knowledge of samba or NIS if networking is desired


This example requires the following hardware/knowledge:

  • An Arduino Board or equivalent (I used an actual Arduino Board with the USB connection)
  • Linux computer that is able to communicate with the Arduino (I used an Ubuntu 8.x box)
  • A Windows computer that is able to support AutoIT (I used an XP box)
  • A network between the two computers
  • Development languages - BASH scripting for Linux and AutoIT for windows
  • Knowledge of samba for sharing folders over the network


Example of Communications Method

Quick Guide:


Step 1 - Buy an Arduino Board - http://www.arduino.cc/en/Main/Buy

Step 2 - Load the Arduino software on your linux box - http://www.arduino.cc/en/Main/Software

Step 3 - Load the following Arduino code into your Arduino board - http://www.arduino.cc/en/Guide/HomePage

Step 4 - Create a Folder on the Linux box and share the Folder over the network using samba - http://us1.samba.org/samba/

Step 5 - Compile the Arduino-Serial software and place the executable in the shared folder - http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/

Step 6 - Load the following BASH scripting text into an executable file in your shared directory on the Linux box - http://www.gnu.org/software/bash/

Step 7 - Build your Thermistor circuit based on the following diagram or something similar

Step 8 - Map your 'samba' share to a windows drive

Step 9 - Load AutoIT on your windows box - http://www.autoitscript.com/autoit3/

Step 10 - Use the following AutoIT script to test the solution

Step 11 - Revel in your new found capability to conquer the world, well the Arduino world anyway! `,~)


Links

Personal tools
Sponsers
Your Ad Here
Your Ad Here