Can I access Arduino variable values from a PC?

Hi,

Background - I have a standalone Arduino monitoring system in mind. The master Arduino will receive events from the remote sensors and display them on an LED panel. So the status of the sensors will effectively be in master Arduino unit memory (i.e. the value of the variables I assume).

Question - Is there a way with the master Arduino connected via it’s USB port to a computer for some software I write on the computer (be it Processing or otherwise) to access the sensor state (or variables in other words)?

If no, any other suggestions for how I could handle this? (i.e. effectively want a separate/PC view of the status of things from the master Arduino). What would be the best way to organise this?

thanks

You can have the PC ask for the values of variables, or you can push values from the Arduino, but direct access, no.

Have a look at Firmata to see if that's the sort of thing you want.

Is there a way with the master Arduino connected via it's USB port to a computer for some software I write on the computer (be it Processing or otherwise) to access the sensor state (or variables in other words)?

Quite simply yes you can do all that if you write the code to do it. The problem with Firmata is that you can only communicate with a PC you can't do anything interesting in the arduino.

actually I think I'm still a little confused - I looked on the firmdata page at http://arduino.cc/en/Reference/Firmata and the code seems to look like the normal ardunio code one uploads? How does firmdata fit in then. So I had in mind:

* PC 
  - My software running on PC (Software B) - perhaps Processing or C# code or something
    - uses some Library (serial?) to talk to Arduino
|
usb
|
* Arduino
  - software uploaded originally from PC to run in Arduino (Software A)
    - base Arduino bootstrap code maybe (still not an Arduino expert)

Where does firmdata run exactly in the mix here? My question was basically can I run Software B that can communicate in and get access to variable data from the Software A running on the Arduino.

Firmata is software that runs on the arduino. It services commands sent by a PC over the serial line. These are things like set this pin read that pin. It is for people who can't programme an arduino to do what they want so they move all the smarts into the PC end.

You don't want to do this you just want to do what you said in the code box.

My question was basically can I run Software B that can communicate in and get access to variable data from the Software A running on the Arduino.

And my answer is basically yes if you write the arduino software to do it.

thanks - so re "And my answer is basically yes if you write the arduino software to do it."

do you mean then in my Arduino, in the main loop I would have to handle both the normal sensor detection as well as then checking for incoming requests from the PC?

If yes what form does that latter communication come in, for example: - from the Arduino side are there special commands to talk via the USB port (e.g. print(xxxx) equivalent via USB) - from the PC side does the Arduino appear as a serial COM port, so any software that can talk serial then?

Lastly on the PC side are there language binding available to abstract talking serial for Arduino? e.g. for say VB/C# or something?

thanks

do you mean then in my Arduino, in the main loop I would have to handle both the normal sensor detection as well as then checking for incoming requests from the PC?

yes

from the Arduino side are there special commands to talk via the USB port (e.g. print(xxxx) equivalent via USB)

It's just the serial commands:- http://arduino.cc/en/Reference/Serial

from the PC side does the Arduino appear as a serial COM port, so any software that can talk serial then?

Yes that's it.

Lastly on the PC side are there language binding available to abstract talking serial for Arduino?

Depends on the language you use but basically you don't need anything just to talk to a com port.

thanks Mike - I think that clear thing up most for me

BTW - I noted in the doco:

"Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip."

So I'm realising I'm not sure how a USB connection actually works - is there actually 2 physical wires in a USB cable that are just effectively a physical serial connection with TTL serial data then?

s there actually 2 physical wires in a USB cable that are just effectively a physical serial connection with TTL serial data then

No the FTDI is a USB to serial bridge chip. To the PC end it looks like a USB device and communicates in standard USB fashion. It the uses that data to implement a physical serial link TX, RX plus lots of handshaking which the arduino doesn't use. In fact on of the handshaking lines is used to reset the arduino so that when a connection is activated the arduino resets.

The TX & RX LEDs on the arduino as simply GPIO pins on the FTDI chip and the COM driver in the PC flashes them when serial communication is taking place. The FTDI chip also has a buffer in to on the TX and RX side so the communication between the PC and the chip is the normal polled bursty type USB communications.

So physically it is very different from a straight serial connection but from the programmers point of view it is a simple COM port.