Go Down

Topic: Getting data file from PC to arduino (Read 238 times) previous topic - next topic

robertjenkins

Hello

I have a project which needs data to be stored in an EEPROM. That's easy enough, but sometimes the data will need to be replaced by another dataset, and this will need to be done by a remote consumer who will not be technically clued up. I can include an SD card reader in the hardware and mail the user an SD card when necessary, but that will all take up physical space, and I would like to find another way. Obviously it is not hard to upload data from the PC to the arduino EEPROM using a serial link, but I'm looking for some kind of automated front end interface, eg a Windows app, that could do this automatically as soon as the PC and Arduino are connected. So then I would just email the user the new data file. Like an automated firmware upgrade. Is there anything available that can do this?

gilshultz

Why not consider WiFi, that makes the connection easy. It will require code etc.  Check out some OTA (Over The Air) programming examples.  You could also use Bluetooth.  This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

Robin2

I think WiFi would require extra hardware at the Arduino end whereas the OP envisages just a USB cable connection between the Arduino and the PC.

I don't know whether it is possible for Windows (or Linux) to identify when a specific Arduino has been connected - for example suppose the user has another Arduinos in addition to the one that the OP wants to upload data for.

I think if this was my problem I would write a PC program and give the user instructions how to use it when he connects the Arduino for the data upload. The PC program (and the Arduino) could have some pre-programmed dialogue so that the PC can verify that the correct Arduino is connected.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

robertjenkins

Yes I'm looking for a solution that doesn't require more hardware (eg WiFi or Bluetooth shield) and will work for extremely naive users (who have never heard of an Arduino.) I've never written a Windows program and suspect it would be a steep learning curve to produce something that was non-buggy. I was hoping that someone else had already done the work. Long shot I suspect

Robin2

#4
Feb 15, 2020, 11:59 am Last Edit: Feb 15, 2020, 12:01 pm by Robin2
I've never written a Windows program and suspect it would be a steep learning curve to produce something that was non-buggy.
Probably. That's how the prices for commercial software are justified - you can have this program for $50 or you can spend 6 weeks figuring out how to do it yourself.

If you are selling your product then it seems like you would be making yourself more valuable if you did learn how to do the PC programming.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Paul__B

#5
Feb 15, 2020, 12:19 pm Last Edit: Feb 15, 2020, 12:20 pm by Paul__B
I think WiFi would require extra hardware at the Arduino end whereas the OP envisages just a USB cable connection between the Arduino and the PC.
Not at all!  For WiFi, you use an ESP8266 (or ESP32) instead of an Arduino as such.  Which - if you still need an SD card - is very convenient as the interface is 3.3 V.

Also, an ESP8266 on WiFi can automatically update itself from the Internet with no Windoze connection and no user interaction at all.  :smiley-cool:

robertjenkins

Thanks. I'm using a version of the Arduino Pro which has a small nrf24l01 module on the board. the RF24 protocol is pretty key and while I could change the whole project to use wifi or bluetooth instead, that would be more trouble than it is worth (eg backward compatability with existing projects). The ardunio pro modules don't have a USB scoket anyway, so I would have to add some kind of socket to connect to the serial pins ... I think a small SD card might not be too high a price in the long run. After all, I can always email the new file to the user and  it's not too hard for them to copy it to a card.

What would be really useful would be some way to boot the whole arduino from a SD card, so not only the data but the code itself could be upgraded remotely, but as far as I can see no one has found a simple way to do that.

wildbill

I've never written a Windows program and suspect it would be a steep learning curve to produce something that was non-buggy.
Writing full windows programs is a steep learning curve. Since you already know C++ though, doing an old school windows forms app using C# (or even VB) for your simple needs wouldn't be that bad. You could probably get there in two or three days.

sterretje

A number of of-the-shelf terminal programs can send files from PC to a device connected to the serial port; I use RealTerm but there are plenty others

At the Arduino side, you can read the received data and store in EEPROM. As writing to EEPROM is slow, you will need to implement a handshake (xon/xoff look it up).

xon/xoff uses dedicated 'characters' and for that reason will only work with text based files.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Robin2

#9
Feb 15, 2020, 02:01 pm Last Edit: Feb 15, 2020, 02:08 pm by Robin2
Thanks. I'm using a version of the Arduino Pro which has a small nrf24l01 module on the board. the RF24 protocol is pretty key
Just a moment now ... This is a whole lot of new information that was not part of your Original Post. You can't expect us to be able to give useful advice based on partial information. I have been assuming you were using an Uno or nano with an onboard USB connection.

Take a few moments to describe the whole project, what it does, what the EEPROM data is for, why it might need to be updated, and the exact hardware that your user will have.

A number of of-the-shelf terminal programs can send files from PC to a device connected to the serial port; I use RealTerm but there are plenty others
It is my understanding that the OP is looking for a system that could be used reliably by a customer who knows nothing about Arduinos and very little about computers - great aunt Matilda, perhaps. To my mind this needs an interface in which the user plugs in the Arduino board and double-clicks a program icon and does not have to do anything else.



Thinking more about the problem, maybe the best solution is to use an SD Card rather than EEPROM memory and then the user can just replace the SD Card - no need for any program interaction. And it has the advantage that if the new SD Card does not work the user can resume using the previous one. (It really pisses me off that so many PC software upgrades are not instantly undoable)

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

robertjenkins

A number of of-the-shelf terminal programs can send files from PC to a device connected to the serial port; I use RealTerm but there are plenty others

At the Arduino side, you can read the received data and store in EEPROM. As writing to EEPROM is slow, you will need to implement a handshake (xon/xoff look it up).

xon/xoff uses dedicated 'characters' and for that reason will only work with text based files.

Great, thanks

robertjenkins

.
Just a moment now ... This is a whole lot of new information that was not part of your Original Post. You can't expect us to be able to give useful advice based on partial information. I have been assuming you were using an Uno or nano with an onboard USB connection.

Take a few moments to describe the whole project, what it does, what the EEPROM data is for, why it might need to be updated, and the exact hardware that your user will have.
Ah well, this is always the difficulty. Give too much information, and posters can get sidetracked by irrelevant information and try to reinvent your whole project. Give too little and it risks the wrath of such as yourself  :)  I'm not sure anything in my original post justified the belief I was using a nano or Uno ...

But here goes: the system consists of a ardunio pro/NRF24l01 connected to an RFID reader (I'm sure you don't want to know about that) which reads tags and transmits the bytes to a similar set up which decodes them, compares them against values stored in the EEPROM and displays text on a small OLED screen. Space is at a premium on the receiver, and so is the need to minimise current because it will be running from a small LIPO battery. I envisage that the EEPROM on the receiver end will be coded for the tags, and there will be no need for an SD card to be inserted unless a new set of RFID tags is used, which will need a new dataset. (I don't want to have the current consumption overload associated with the SD setup in normal use).



Quote
It is my understanding that the OP is looking for a system that could be used reliably by a customer who knows nothing about Arduinos and very little about computers - great aunt Matilda, perhaps. To my mind this needs an interface in which the user plugs in the Arduino board and double-clicks a program icon and does not have to do anything else
exactly.

Quote
Thinking more about the problem, maybe the best solution is to use an SD Card rather than EEPROM memory and then the user can just replace the SD Card - no need for any program interaction. And it has the advantage that if the new SD Card does not work the user can resume using the previous one. (It really pisses me off that so many PC software upgrades are not instantly undoable)

...R
Yes - that is more or less where I was starting, except that the receiver end would come with the original data on the internal EEPROM, but with a SD card in case the EEPROM got corrupted, or if an upgrade was needed. In case of the upgrade, the SD reader would rewrite the EEPROM and then the card could be taken out and stored. I haven't looked into this but I assume there will be current-consumption advantages in using the EEPROM rather than the card reader most of the time.

I think this is going to be OK, but I was really trying to think of ways to make it even easier.

Robin2

Yes - that is more or less where I was starting, except that the receiver end would come with the original data on the internal EEPROM, but with a SD card in case the EEPROM got corrupted, or if an upgrade was needed. In case of the upgrade, the SD reader would rewrite the EEPROM and then the card could be taken out and stored. I haven't looked into this but I assume there will be current-consumption advantages in using the EEPROM rather than the card reader most of the time.
My suggestion is to use the SD Card all the time and not use the EEPROM memory at all - even for the original version. Then there is no need for copying data to the EEPROM. I would expect an SD Card to be every bit as reliable as the internal EEPROM memory.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Paul__B

Ah well, this is always the difficulty. Give too much information, and posters can get sidetracked by irrelevant information and try to reinvent your whole project.
That is to say, point out the most obvious blunders.  The XY problems.  :smiley-lol:

Give too little and it risks the wrath of such as yourself  :)  I'm not sure anything in my original post justified the belief I was using a Nano or UNO ...
Except that it did not specify the critical detail.  By default, when a poster does not explain what Arduino they are using, it indicates they are a beginner using the "basic" Arduino, the UNO (and just as likely, a clone which is not a UNO at all but mis-labled).  One expects a reasonably competent constructor to be able to adequately explain a situation.  :smiley-roll:

GoForSmoke

I've never written a Windows program and suspect it would be a steep learning curve to produce something that was non-buggy. I was hoping that someone else had already done the work. Long shot I suspect
The Arduino IDE was written to go with the PC language Processing. They are -very- similar.

https://processing.org/

You might make a program that gets data from your FTP site and feeds it to an Arduino if the customer has internet.

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Go Up