Go Down

Topic: Sending Data Wirelessly from Arduino via WiFi and into Excel? (Read 731 times) previous topic - next topic

xxxERRORxxx

Hi, first time posting!

I am trying to use a Arduino UNO to send wind data to an Excel Sheet on a computer wirelessly.

I have a 6410 Davis Anemometer for Vantage Pro2 connected to my Arduino (Here is the guide) and can confirm that my program is able to send data from the Arduino to Excel via the USB cable successfully with the use of PLX-DAQ version 2.

I purchased a DFRobot WiFi Shield v2.2. I am successful in getting the Arduino to send text to Putty wirelessly as I hooked the Arduino to a battery (with the code below). All the text is showing up in Putty.

Code: [Select]
#include <math.h>
#include "LowPower.h"

int i = 0;

#define WindSensorPin (2) // The pin location of the anemometer sensor
#define Offset 0;

int VaneValue;
int Direction;
int CalDirection;
int LastValue;

volatile unsigned long Rotations; // cup rotation counter used in interrupt routine
volatile unsigned long ContactBounceTime; // Timer to avoid contact bounce in interrupt routine

float WindSpeed; // speed miles per hour
float WindSpeedMetric;

void setup() {
Serial.begin(9600);

Serial.println("LABEL,Date,Time,Wind Speed M/S,Wind Speed MPH,Direction");

pinMode(WindSensorPin, INPUT);
attachInterrupt(digitalPinToInterrupt(WindSensorPin), rotation, FALLING);

LastValue = 1;
}

void loop() {

VaneValue = analogRead(A4);
Direction = map(VaneValue, 0, 1023, 0, 360);
CalDirection = Direction + Offset;

Rotations = 0; // Set Rotations count to 0 ready for calculations

sei(); // Enables interrupts

delay (10000);

cli(); // Disable interrupts

// convert to mp/h using the formula V=P(2.25/T)
// V = P(2.25/3) = P * 0.75


WindSpeed = Rotations * 0.225;  //this is for 10 second delay

WindSpeedMetric = Rotations * 0.225 *  0.44704;
 

char text[40];
char text1[40];

Serial.print("DATA,DATE,TIME,");
Serial.print(WindSpeedMetric); Serial.print(","),
Serial.print(WindSpeed); Serial.print(",");
Serial.println(CalDirection);

if (CalDirection > 360)
  CalDirection = CalDirection - 360;

if(CalDirection < 0)
  CalDirection = CalDirection + 360;
}

// This is the function that the interrupt calls to increment the rotation count

void rotation () {

if ((millis() - ContactBounceTime) > 15 ) { // debounce the switch contact.
Rotations++;
ContactBounceTime = millis();
}


Now the issue I am having is figuring out how to get PLX-DAQ to grab the data/text from Putty and insert it onto Excel (or in general: sending data wireless with a WiFi shield and into Excel). I see PLX-DAQ is the best way to insert my data into Excel. Maybe I need a different program to grab the data sent by the WiFi shield?

Any help would be appreciated. Thank you.

PaulS

Quote
Now the issue I am having is figuring out how to get PLX-DAQ to grab the data/text from Putty
It can't.

There is nothing in the code you posted that makes use of the WiFi shield, so that is NOT how the data is getting to PuTTY.
The art of getting good answers lies in asking good questions.

xxxERRORxxx

There is nothing in the code you posted that makes use of the WiFi shield, so that is NOT how the data is getting to PuTTY.
Yes I know. Nothing in the code is required when using the DFRobot WiFi shield. It works as it should. I just don't know what to use to get the data sent out of the WiFi shield and put it in Excel.

Nick_Pyner

Now the issue I am having is figuring out how to get PLX-DAQ to grab the data/text from Putty and insert it onto Excel.
This is not an Arduino problem and probably not possible anyway. It is so stupid nobody would bother, even if it was..
Quote
or in general: sending data wireless with a WiFi shield and into Excel
PLX is a macro that essentially makes Excel into a serial terminal, i.e. a just very smart version of Putty. It listens to a COM port. It has no WiFi capability.
Quote
Maybe I need a different program to grab the data sent by the WiFi shield?
Correct.
Another option might be to ditch the WiFi, and use Bluetooth instead. All you need do is ensure that PLX can listen to the COM port that Bluetooth is using.


xxxERRORxxx

This is not an Arduino problem and probably not possible anyway. It is so stupid nobody would bother, even if it was.. PLX is a macro that essentially makes Excel into a serial terminal, i.e. a just very smart version of Putty. It listens to a COM port. It has no WiFi capability.Correct.
Another option might be to ditch the WiFi, and use Bluetooth instead. All you need do is ensure that PLX can listen to the COM port that Bluetooth is using.


Hmm Bluetooth might be alittle hard to come by as I'm thinking the range will be a issue for me. I looked at another method with which is XBee setup found here.

I think it solves the problem where now with XBee's explorer USB, PLX can read the COM port that the receiving XBee is connected to. Can you confirm what I am thinking is correct?

Nick_Pyner

I don't know anything about XBee but the criterion is clear - something that can receive a signal over WiFi and convert it to serial. If XBee make something that receives data by WiFi and plugs into a USB port on your PC, I guess it should work. If they don't, I guess it won't.

I would try a Node-MCU to do that. People smarter than me would probably use a bare-bones ESP8266 - $2-50.

The advantage of bluetooth, and hence my original comment, is that you already have the code, and it works. Note that Bluetooth4 has much greater range than your plain-vanilla HC-05 - about 100m


xxxERRORxxx

The advantage of bluetooth, and hence my original comment, is that you already have the code, and it works. Note that Bluetooth4 has much greater range than your plain-vanilla HC-05 - about 100m

Hmm okay I looked into Bluetooth and I found some stuff. So if I were to use bluetooth I would have to get one of this for the Arduino and one of this for the PC. Then follow a guide like this one and based on logical reasoning, the PLX can read the serial data coming in from the COM port the bluetooth USB adapter is plugged into. Am I missing something?

Thanks for helping me by the way.

gdsports

Sounds like the DFRobot WiFi shield, after being configured, is a UART to TCP transparent bridge. It listens on TCP port 4000. When PuTTY connects to the shield on port 4000, Serial.print sends data out the Uno UART, into the WiFi shield UART, out over WiFi TCP port 4000, to PuTTY running on the PC.

I hope this summarizes the data flow.

Code: [Select]

Uno -> DFRobot -> WiFi   -> PC running PuTTY
       Shield     Router   


I suggest connecting to the PC an ESP8266 NodeMCU or WeMos D1 mini running a pass through program. The sketch should connect to the AP, connect to the DFRobot shield on port 4000. Then in loop(), everything that comes from the TCP client must be written out the UART using Serial.write.

On the PC, the data from the Uno will come out a PC COM device.

Code: [Select]

Uno -> DFRobot -> WiFi -> ESP8266 -> UART USB -> PC COMx -> PLX-DAQ -> Excel
       Shield     Router  WeMos or             
                          NodeMCU

Nick_Pyner

Hmm okay I looked into Bluetooth and I found some stuff. So if I were to use bluetooth I would have to get one of this for the Arduino
Yes, sort of.
That is a BLE module and has the longer range. They say it is a slave, and as a slave it will do what you want, but I don't believe it is is a slave and they should have said it is configurable as a master. Just in case they really do know what they are talking about, I would get one elsewhere, as you may want a configurable one in the future.
Quote
and one of this for the PC.
No.
They are quoting the range of a bluetooth 2 device. It could be really BT4 but they really don't know what they are talking about. Your BT4 device may work with it anyway but, if it does, it does so by reverting to BT2 mode and you lose the range advantage of BT4. You need to be sure it is a BT4 dongle, and buying from somebody who isn't is a bad idea. It also needs to be capable of standard SPP protocol for simple data transmission I think they usually are.
Quote
Then follow a guide like this one
Possibly.
This is addressing BT2 stuff, not BT4. It may suffice, but there is probably better stuff around that is more BT4 specific. Look here first http://www.martyncurrey.com/hm-10-bluetooth-4ble-modules/
Quote
and based on logical reasoning, the PLX can read the serial data coming in from the COM port the bluetooth USB adapter is plugged into. Am I missing something?
Possibly.
When I was using PLX and wanted to move to Bluetooth I couldn't do it. This was simply because the bluetooth built into my Dell laptop was on COM40, I couldn't call, it from PLX,  and I couldn't fix it. I solved the problem by using the phone instead. This was with the original PLX from Parallax. Since then a new version of PLX has been released by the Hero of the Arduino Forum, NetDevil. I have raised this problem with NetDevil but I have never used PLX v2 so I don't know what the state of play is there.  I assume you are using PLXv2 and you should check this. I believe this is the only problem you might have, and you may be able to manage the COM ports on PC anyway.

You have not confirmed that you need BT4. A BT2 like the HC-05 is good for 10m in line of sight.

Back on the WiFi tack, while I said
Quote
People smarter than me would probably use a bare-bones ESP8266 - $2-50.
I'm now pretty sure they wouldn't. A Node MCU would do the job without having to mess around with peripherals. It simply receives the data via WiFi, and talks to PLX via serial, getting power from the same USB port. Similarly, it may make sense to retire the Uno and use a Node-MCU at the transmitter end. It should be able to run your Uno code essentially unchanged.



JelleSiemonsma

 I've made  some software for implementing a FSM and also a VBA app (windows 10) for control and presenting/collecting data (HMI) based on a serial connection and for WiFi. At the moment i'am testing the reliability of the Wifi connection to my VBA program on windows10. Working now for more than a week.
Configuration: MEGA2560 with a DS18B20, via hardware serial an ESP-07/ESP8266 connected to internet. Data is writen to an Access database. See my experiance on www.jbsiemonsma.nl.
If you still want a serial connection, try an APC220 radio connection (100m no problem)

Go Up