Hi, I am in the process of programming an automated pill dispenser that I am building as a project; two pills are dispensed per day, each at a time set in the morning and evening. The alarms at the medication times are just defined by integer values, e.g. morninghour and morningminute. Is there a way I could have a .exe or any software in order to change these values in the code and upload it by itself, instead of having to open the code in IDE, change them and upload from there?
Most Arduinos have EEPROM (and I think that on all of them you can use simulated EEPROM) ; you can store the times in EEPROM. Which Arduino are you using?
You can use a terminal program (serial monitor or any 3rd party one) to change the times and store them in EEPROM.
For serial communication with a PC, you can get some ideas from reading Serial Input Basics - updated.
Hi, thanks for the fast response. My deadline is fairly soon and I'd prefer minimising how much I add to the existing code in order to make it possible to upload timings. It's not a necessary feature for me but one I wouldn't mind having, so I was just wondering what the absolute simplest way to do it would be - the way I thought about it in my head was to have a program to just alter the values directly in the code, and just upload it just like IDE would. Do you have any suggestions, or would the process just not be as simple as that?
you could use an Arduino with WiFi capabilities and then you could connect to the device wirelessly to provide the settings.
With an ESP32 for example, you could use WiFiManager to provide an user interface. Pretty trivial to implement.
Bluetooth could also be an option.
I have got an ESP32 but the issue here would be the fact that I've already got a PCB on the way designed for a Nano
ah... then @sterretje ideas are worth exploring. offering a small command line interface through the Serial port to update the values stored in EEPROM could be done easily
Hello danny800
Design an adapter PCB to connect an ESP32 to an Arduino NANO pin out design.
My recommendation is to use BT, too.
doesn't sound like a very flexible system if you have to or a user has to modify the code to change the parameters.
seems that the parameters
- need to be stored in EEPROM
- need to be settable thru the serial interface
i also wonder if the current time is also something that needs to be set unless an RTC is being used and then even that needs serial commands for adjusting (e.g. timezone)
If you store the parameters in a header file, it is trivial to generate that from a script. I believe arduino-cli provides command line build, I guess it also provides upload. If not, it should be easy to call avrdude or whatever directly.
You could do all that in a batch file if on Windows, or equivalent shell script on Linux.
yes, an RTC is being used and the product won't need to switch timezones so that isn't an issue
this is just a small school project, and I was exploring any extras I could add to it - I'll probably take a look at changing EEPROM values now.
I understand the logic here, and agree BT is probably the way to go but my deadline is just too soon to go through all of that. As mentioned earlier this is in no way a necessary feature, I was just exploring some ideas
You could have a text file on a SD card . If you wanted to change times that could be done with a text editor in a PC
what would the text file contain? are you suggesting that the arduino code reads the timings from there?
Values for the times , read them in and associate them with variables you then use
fair enough, I'll have a look into this too but I'm not entirely sure an SD card would be viable for my product
Now what is it?
a commercial product?
or schools project?
Why would a "small shool project" require designing a PCB?
The simplest way would have been to use an ESP32 and a GUI-library where the ESP32 creates his own WiFi you connect with any smartphone change values and tap on "store values"
➜ OP said
So looks like he has done his homework and wants to add a few bells and jingles.
A serial command line interface would be a nice addition
yes, precisely
Congrats for willing to go the extra mile. Great attitude.
Thank you! Not only doing this for extra credit but really just wanted to broaden my arduino knowledge