Send sensor data to PC wirelessly

Hi I have a question that I'm still confused about for my project.

I'm planning on having my Arduino in a lake and transmit water quality data to my PC. I believe Wi-Fi or Bluetooth is my best option due to the range. Since the Arduino and PC won't have access to the Internet, how would I go about sending the water quality data to the my PC?

I'm not really understanding how the Arduino will be able to communicate/connect to the PC. Would I use a program like RealTerm and have the Arduino send the data to that?

I'm kind of struggling with this so all information will help!!
Thanks!

1 Like

Hi yeoj

I am no expert but I have a very similar setup.

I have one Arduino with the sensor (i.e. in the middle of your lake), and another arduino connected to my PC via USB cable. The two arduinos talk to each other via a 2.4GHz NRF24L01 whatsit (google "arduino NRF24L01 "). I have not tried to get these up and running yet (next week...) so I dont have any test results.

Here are the ones I use: http://www.ebay.co.uk/itm/290987371933?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

They connect to each arduino via SPI. Only gotcha is 3V power if you are using 5V signal lines.

I bought ones with aerials, I have read user tests online and they confirm >100m without packet loss. This is good enough for my project, not sure what the max range is though. I also have two other radio units for very long range (>1km) - transmitter & receiver (Ciseco XRF and ARF).

Hope that helps.

B

yeoj:
I'm planning on having my Arduino in a lake and transmit water quality data to my PC. I believe Wi-Fi or Bluetooth is my best option due to the range.

WiFi is rarely the best choice, unless you need or want ubiquity. Bluetooth may be better but has a relatively short range. Have a look at XBee before making your final decision.

Since the Arduino and PC won't have access to the Internet, how would I go about sending the water quality data to the my PC?

Connecting across a network is fundamentally similar to physically connecting two devices with a serial cable. Unlike a serial cable, network endpoints are defined virtually, by numeric addresses. The network protocol stack provides the interface between an application (at OSI layer 7) and the physical connections between devices (at OSI layer 1). Provided you have a functioning stack and the right address , your application does not need to worry too much about how the network might make the physical connection.

The Internet is built on the TCP/IP transport protocol. There used to be many other transport protocols but the Internet caused TCP/IP to become the de-facto standard. A short time later, the Sockets API was created to standardise the interface between applications and the TCP/IP protocol stack. In brief, you open a socket, connect to an address and you have yourself a data stream, just like a serial cable provides a data stream.

I'm not really understanding how the Arduino will be able to communicate/connect to the PC. Would I use a program like RealTerm and have the Arduino send the data to that?

You could do that, or you could use a PC development environment to roll your own application. Virtually all programming environments provide a Sockets API these days. Some are easier to use than others.

I'm kind of struggling with this so all information will help!!

There are many resources covering the OSI 7 Layer Conceptual Model, which is a great place to start learning how modern networks work. Note the word 'Conceptual' in the name. Real World protocols do not map exactly onto the OSI model.

After briefly familiarising yourself with the principles of the OSI model, which is all you need to do. You might go on to find a high level language (like BASIC or Python), with a Sockets interface and send some data between two PCs. With the understanding such an exercise provides, you would be in a much better position to start programming a sockets application using lower level C/C++.

Hi Matt - thanks for that, I have come across the OSI model before but could never work out why I should care.

Wikipedia is crazy for it - someone(s) have put a lot of work into representing it correctly (presumably): OSI model - Wikipedia

Keeping it simple, for OP and me it's just a matter of sending some bits/bytes from one arduino to another via SPI and the radio hardware? (I know this simplification makes a mockery of the excellent work done by those peerless boffins at the ISO...)

B

Thanks for the info Matt. I've ran into the OSI standard before but it's a bit overwhelming with all the data out there.

Also bazmonaut thanks for the suggestion on the wireless transmitter that your bought! I'll do more research on it! If you do plan on getting your setup working next week could you let me know how it goes?
Also how do you plan on capturing/saving the data that the Arduino is receiving from the other one?

Thanks again, Yeoj

Hi yeoj

I am taking a sneaky day off work today and am planning to get the radio modules up and running, will let you know how it goes.

It looks reasonably straightforward (he says, not having done it yet). There are libraries for the nRF24L01 and lots of 'how to's online - I downloaded the Mirf library and example sketches for here: Arduino Playground - Nrf24L01

My project is a rocket motor test stand, for testing home-made motors. This is length of heavy steel angle with gubbins bolted to it, including a Nano v3.0 which runs the show:

  • home-made load cell - this measure force of motor
  • voltage from load cell is amplified by INA122 amplifier
  • voltage from amp is read by ADS7816 12-bit ADC, connected to the Arduino via SPI
  • Arduino records voltage on an Adafruit '5V-ready' SD card breakout board via SPI
  • Arduino also fires the motor via a relay and a digital pin (relay connected to 9V battery)
  • powered by 4 x 3.7v Li-ion 14500 cells, also LM7810 10v regulator (for load cell) and LM7805 5v regulator for the ADC and SD card breakout

I'm using the 5v regulator as I get variable voltages out of the 5v pin on my arduino (have googled but not found the answer to this one), and I need a stable reference voltage for the ADC.

The previous version of this stand did not have the SD card module, I was recording the data via the USB cable directly onto my PC. This was not ideal as I lost some data, and the frequency of the ADC readings was reduced because of the Serial.print() function. The previous version also didn't have the separate ADC, however I found that the Arduino's onboard ADC would jump values when I set a digital pin to high to fire the motor - this is normal apparently.

My motors are getting bigger, and during the last firing I felt a teensy weensy bit too close to the action - my 10m USB cable isn't long enough, and also I had one Nano trashed in the past when my 4 year old son tripped over the wire and ripped the USB socket from the board.

So, this is why I am going for the radio modules. The situation sounds similar to your lake project, except all my action happens in 2-3 seconds.

I hope one day to finish the test stand and get back to rockets, but I am having so much fun with it I can't seem to stop adding stuff! I have a 16x2 LCD display on my desk which is looking at me with its big sad eyes...

B

1 Like

Hi yeoj

I didn't manage to get the modules working completely - I am going to start a new topic on this. I switched to the RF24 library as it seems to offer more debugging capability (available on github).

Good luck with your project.

B