This is my very first Arduino project. I have the Duemilanove which seems to be a very capable and useful device. I have literally decades of experience with computer-based systems and lots of robotics experience, so this project should be a walk in the park.
The issue is my lack of familiarity and not knowing the capability of the device itself. In a nutshell, I am making a remote control for a test rig and bearing off the operation of the rig to the Arduino. Simple enough. However, can I use the USB port that programs the board to also send instructions to the Arduino when it is running the test rig (such as telling to open valve M), and in turn can the Arduino send readings and data back to the computer (Pressure is too high! Augh!) through the USB?
So, the setup is that once running, I want to use the USB to communicate instructions and results of the process. I am sure that somebody here will know this one.
Thanks in advance, and I appreciate the forum. I will happily share any results of my project if it will benefit others.
It may help for me to clarify a little, although I’m pretty sure most people here will understand anyway.
I had planned on using pins 0 and 1 as the traditional serial interface channel and doing it the simple way, using a USB-to-serial converter so a desktop computer could be my go-between. That machine will have a graphic interface of the process, the valve states, the inputs, etc. The Arduino is just accepting commands and operating the hardware, taking readings such as pressure and temperature and reporting them back, and it will also have a little native intelligence so it can do things like shut the rig down rapidly if an E-stop or some pre-defined condition occurs. It will have a couple of built-in programs to allow a manual operation of the setup while still logging the data for records and safety purposes. It also processes the data a little to make it more “human readable” and for recording purposes.
So in effect, I would like the option of using the existing USB rather than having to add the serial to USB converter, but this is not a must. It would just make things cleaner.
Again, thanks for your patience and consideration.
Yes it should be easy to handle the two-way communication you want. The USB port on the board is connected to an FTDI chip (see http://arduino.cc/en/Main/ArduinoBoardDuemilanove) which is already connected to pins 0 & 1. When the USB port is connected to your PC a new serial port connection should be registered (if the correct FTDI driver is installed of course). Using Arduino's serial library is just about trivial, look through the examples that ship with Arduino.
Thank you Christo, that is what I needed to know. As a newcomer, I figure it will take a couple of days to get up to speed with these. So far, I have written and checked my interrupt routines, the I/O stuff, and now I'm just working on the numeric data part. I just started this morning but from what I see everything is very straightforward. Again, thanks.
I will happily share any results of my project if it will benefit others.
Please do, many will benefit, for sure.
It turns out to be trivial. I created a board that has a thermocouple amplifier circuit for two channels, an optocoupler circuit to read an event counter, and a simple pressure sensor interface. I added some solid state relay output channels and connected this card to the Duemilanove card. The software was also simple enough- I send one-letter commands to trigger a read or to control the SSRs. At the PC end everything is also that easy- my program is in Python and it does a serial connect through the USB virtual com port. Now it sends periodic commands to the Arduino and it in turn controls or reads the hardware through my circuit board. The data is sent back usually through printline instructions. It reads through the USB as a datalogger, no extra code or tricks needed.
Altogether, this has been a simple and direct solution to an automation problem. I am building a second system right now.