Hi guys!
What I would like to do is, have an usb connector on my arduino where I can plug a USBDRIVE with arduino code, and it uploads itself to the arduino.
This way I could upgrade the firmware on my creations without a computer.
Is that possible? What do I need to do it?
Yes, but you must have a second arduino that acts as the programmer right?
I was looking into the possibility of doing it all with one arduino.
A bit like you can do with the BLE bluetooth
macsoft:
I was looking into the possibility of doing it all with one arduino.
If you use an Arduino Ethernet, which has the SD card reader on the board, then you could use an SD bootloader like GitHub - zevero/avr_boot: Arduino Bootloader to Flash from SD Card. That way you just plug in the SD card and turn on the Arduino and it loads the program from the card automatically.
Its a possibility.. But I would prefer to use a Nano or if not: an UNO. with such cheap wifi modules, that could be the only use for the Arduino Ethernet
macsoft:
But don't I need a second arduino to be the programmer?
Well you will need a programmer(or another Arduino with the ArduinoISP sketch) to burn the avr_boot bootloader to your Arduino to get started but after that you only need to compile your sketch into a file named FIRMWARE.BIN, copy that file to an SD card, plug it into the SD card reader module or shield attached to your Arduino, and turn on the Arduino and it will automatically load the file from the SD card just as if you had uploaded it over USB using the Arduino IDE. So it's a bit more hardware involved than you were hoping for but having a programmer or spare Arduino on hand is very useful for many things and those SD card module/shields are super cheap.
Its not really a problem of money, its more a problem of simplicity.
I'm building sensor gathering devices that are going to be left in several parts of the country.
And when it is time to update their firmwares, I would like just to send a file to someone near the device (not electronic inclined people), and they just copy the file to a usbdisk/sdcard and plug it in the device and that's it.
With the suggested approach, this is more difficult. :S
macsoft:
With the suggested approach, this is more difficult. :S
It's only slightly more difficult for the user than your idea of the USB flash drive and probably easier to implement on your end.
Steps required for the user with USB drive:
Turn off arduino
Remove USB drive from Arduino
Plug USB drive into computer
Copy file to USB drive
Remove USB drive from computer
Turn off Arduino
Plug USB drive into arduino
Turn on Arduino
Steps required for the user with SD card:
Turn off Arduino
Remove SD card from Arduino
Insert SD card into USB SD card reader
Plug USB SD card reader into computer
Copy file to SD card
Remove SD card reader from computer
Remove SD card from SD card reader
Turn off Arduino
Insert SD card into Arduino
Turn on Arduino
So there's 2 more steps involved, inserting and removing the SD card from the reader, very simple processes. Other than that both options are identical. You will burn the bootloader to the device before sending it out so the user won't need to deal with that.
Well, everyone has a USBDISK, but not everybody has and sdcard and sdcard reader, that is why I would prefer the usbdisk option.
But anyways, if I understand it correctly, I still need 2 arduinos in each system, and I was trying to get around that.
I read somewhere you can upload schecks from a tablet thru Bluetooth BLE, without the need of a second arduino. I was hoping I could do the same with USB (bootloader instead of sketch is even better).
pert:
It's only slightly more difficult for the user than your idea of the USB flash drive and probably easier to implement on your end.
Steps required for the user with USB drive:
Turn off arduino
Remove USB drive from Arduino
Plug USB drive into computer
Copy file to USB drive
Remove USB drive from computer
Turn off Arduino
Plug USB drive into arduino
Turn on Arduino
Steps required for the user with SD card:
Turn off Arduino
Remove SD card from Arduino
Insert SD card into USB SD card reader
Plug USB SD card reader into computer
Copy file to SD card
Remove SD card reader from computer
Remove SD card from SD card reader
Turn off Arduino
Insert SD card into Arduino
Turn on Arduino
So there's 2 more steps involved, inserting and removing the SD card from the reader, very simple processes. Other than that both options are identical. You will burn the bootloader to the device before sending it out so the user won't need to deal with that.
macsoft:
Well, everyone was a USBDISK, but not everybody as and sdcard and sdcard reader
You include those with each sensor device(or send one to each user if there are multiple users per device). They are super cheap, even the lowest capacity SD card on the market will hold any program you could fit on an Arduino.
macsoft:
But anyways, if I understand it correctly, I still need 2 arduinos in each system, and I was trying to get around that.
No, absolutely not, you must be getting my suggestion mixed up with CrossRoads'. All you need for the sensor device is an Arduino and a SD card reader module connected to the Arduino via SPI. You will need a programmer or an extra Arduino at your location to be able to burn the avr_boot bootloader to the sensor devices before distributing them but once the bootloader is burned to them it's done, you don't need another Arduino to upload a new firmware to the sensor device.
Ahhhhh! you are right! I mixed both comments, sorry
That is in deed a viable option. I'm gonna order some sdcard modules right away, and I'll give your option a try.
Thank you very much!
pert:
You include those with each sensor device(or send one to each user if there are multiple users per device). They are super cheap, even the lowest capacity SD card on the market will hold any program you could fit on an Arduino.No, absolutely not, you must be getting my suggestion mixed up with CrossRoads'. All you need for the sensor device is an Arduino and a SD card reader module connected to the Arduino via SPI. You will need a programmer or an extra Arduino at your location to be able to burn the avr_boot bootloader to the sensor devices before distributing them but once the bootloader is burned to them it's done, you don't need another Arduino to upload a new firmware to the sensor device.
Another kind of related question:
I see the sdcard module uses the SPI pins on the arduino.
I already am using them for a 16x64 LED Matrix.. is there any way I can connect both devices (sd card module and LED matrix )to the same arduino?
Yes, you should be able to share the SPI bus between multiple devices. You just need to use a separate CS pin for each and then you digitalWrite() the CS pin of the device you want to enable to LOW(you might have to set the other one HIGH to disable if they didn't put a pull-up resistor on it like they're supposed to). avr_boot has options for the commonly used SD CS pins or you can do a simple modification to the bootloader source if you need a different one. When I added Boards Manager install support to avr_boot I tested every combination using an Ethernet Shield which has the W5100 and the SD card reader both connected via SPI and I didn't have any problems.