Arduino for long lifetime

Thanks you for all you help, i will write the code and post it here when it is done, it may take a while

alex0512343:
Thanks you for all you help, i will write the code and post it here when it is done, it may take a while

Just to satisfy my idle curiosity could you also post the switches used? As noted above -

Paul__B:
For interaction with the "general public" you should be using proper pushbuttons - such as those used on arcade machines - not cheapies.

the switches will be crucial to long term success.

Right now i don t have some good switches and i will use the cheap one for testing but u coud recommend some ?

alex0512343:
the psu would be the pc that is located just under the table so the cable won t exceed ~ 1.5 m,

Should be no problem at all then.

alex0512343:
the problem with the clock is that if somehow the arduino can't send to the pc that recording of the push(the pc wont receive it and not confirm) it has to store it in eprom so i wouldn't know the clock at it was pushed anymore using the pc. For that an external clock may work

Well, the Arduino will always be able to send to the PC, the question is whether the program on the PC is running and will receive data; that is the point of weakness. Certainly you should require the PC code to acknowledge the data you have buffered but it makes it much more complex if you expect the Arduino to timestamp it instead of the PC.

You really have to decide how reliable you expect the PC to be and how you are going to manage that. If the PC power goes off, your Arduino will stop and reboot afterwards, if it merely crashes, the Arduino will continue to run unless you then turn the PC off.

To keep accurate time on the Arduino you either have to regularly update some timing function (based on millis()) or include a RTC (and update that when necessary). Just how accurate must these records be?

You only need to save things in EEPROM if you expect the power to go off.

wvmarle:
Also it won't start working slower or so after some time. Remember, it's a microcontroller, it runs your program and only your program. There's no crap like Windows on it - that's for the past 20+ years been what makes people believe such nonsense as computers working slower after time and needing reboots.

Which in the case of Windoze may well be true!

wvmarle:
The Arduino sends and receives data on its Serial/USB interface. As long as you program the Arduino correctly (including proper input sanitising) it will work fine and stable. What you do on the PC side is irrelevant to the Arduino - it just sends and receives its data.

In general, the code running on the Arduino will be vastly more reliable than that running on the PC. :roll_eyes:

alex0512343:
Right now i don t have some good switches and i will use the cheap one for testing but u coud recommend some ?

A starting point: https://www.automationdirect.com/adc/shopping/catalog/pushbuttons_-z-_switches_-z-_indicators

more stylish - Marquardt Produktkatalog

dougp:
A starting point: https://www.automationdirect.com/adc/shopping/catalog/pushbuttons_-z-_switches_-z-_indicators

more stylish - Marquardt Produktkatalog

Gasp The prices!

Remember, the OP said

alex0512343:
Also i would opt for another method for this job i f i will need an expensive arduino, it won t worth the money to buy an expensive one if i could find already a builded module cheaper or maybe a 3 button keyboard and 3d print and enclosure

As suggested in a previous reply, "Arcade" buttons would be a good choice because they are large and built to withstand relatively heavy use. For example these:

s-l300.jpg

The above are illuminated, so you can flash them to draw the customer's attention. But if you buy illuminated buttons, choose 5V, not 12V.

s-l300.jpg

Good point with the flashing buttons
I found some like these but also some metal ones

PaulRB:
Gasp The prices!

LOL pretty high indeed.
Those buttons are probably suitable for remote control - by shooting at them with a rifle...

PaulRB:
Gasp The prices!

For example these:

s-l300.jpg

Clearly, I need to get out more. :slight_smile:

What if i would use limit switched used on cnc s instead of push buttons, doesn't those have less bounce or may be better or wort than those buttons in the picture ?
Is there another way to ensure i don t get fake reading ?

All mechanical buttons bounce. Push buttons, switches, relays - all of them.

Just don't accept button presses for a short while after you detect a button being pressed. That's all you have to do. Or if you really want, a 100nF cap across the switch usually does the job as well.

alex0512343:
What if i would use limit switched used on cnc s instead of push buttons, doesn't those have less bounce or may be better or wort than those buttons in the picture ?
Is there another way to ensure i don t get fake reading ?

You seem to be worrying too much about this. It is easy to fix with 1 line of code. Why are you so concerned about getting "fake" readings? Is there something you have not told us?

My brother has to make this project for the buissnes but he didn t agreed that arduinos can be used in such aplication he opt instead for a keyboard with 3 buttons that i didn t saw yet finding, so in any case i would try making this version using arduino as good as posible maybe i convince him.
He used esp in the past for an plication but they were just freezing amd stop working, needing reset i believe that s why he don t want to use arduino in this because is not precise/ hobby use not for industry..

Both the AVR microcontrollers and the ESP8266 are used big time in commercial projects. That's why we can get them so incredibly cheap - the Arduino boards are just a small fraction of the use of those chips!

The ESP is indeed prone to freezing and needs really careful programming and thorough testing. Especially functions that needs lots of memory (such as htttps) are tricky to get right.

I understand, basically any electronic comercial product is build using a microcontroller but it can be or not the atm that the arduino uses
In future if this is the most viable option i lt can be done a custom pcb with all components that make the arduino runing and the other items nedded for the module to work
I would ask how keyboard are dealing with bouncing ? I saw some chips that help
What arduino biard would be the best in this aplication ?

I suggest a Pro Micro (not a Pro Mini, which is different). Pro Micro can emulate a pc keyboard through its usb interface. Perhaps your buttons could send 3 special function codes to the pc, which your java code could process. Or it can act as a serial device like other Arduino.

wvmarle:
Both the AVR microcontrollers and the ESP8266 are used big time in commercial projects. That's why we can get them so incredibly cheap - the Arduino boards are just a small fraction of the use of those chips!

And that is the "take-home message"; absolutely nothing inferior in any way about the Atmel chips. Nor PIC chips (now same manufacturer), Intel, whatever.

The usability of all microprocessors depends on proper design (of both hardware and software). The Arduino design is generally perfectly sound (but I advise avoidance of using the on-board regulator of the older designs), no faults. There may be a question around "clones" which most of us use with few if any problems but in general, most of the parts come from exactly the same manufacturers in China.

If you write proper code, it will just keep working as long as it is in a sensible environment and provided with consistent power.

alex0512343:
In future if this is the most viable option i lt can be done a custom PCB with all components that make the Arduino running and the other items needed for the module to work

Basically a complete waste of time! :roll_eyes:

alex0512343:
I would ask how keyboard are dealing with bouncing ? I saw some chips that help

Debouncing is performed in software. Adding chips a complete waste of time and money.

I advise a debouncing algorithm that checks for a sustained change in the input statue on every pass of the loop over a period of some ten milliseconds, timed by seeing millis() advance by that number. All three buttons can be debounced simultaneously.

alex0512343:
What Arduino board would be the best in this application ?

For serial - as against HID - communication, a Nano. Definitely not a UNO. You can connect buttons directly to the Nano by soldering, few or no other parts required unless you want to add indicator lamps and such.

If your brother is "fudging" this with a keyboard, the keyboard is a HID. Certainly that is one approach, get a cheap keyboard, take out the actual PCB (it is tiny) and put it in a box connected to the three buttons which are wired to match the desired positions on the original matrix. You can do much the same programming a Pro Micro but hacking a keyboard would definitely be cheaper!

The problem with this is you have to have only one program running on the PC, waiting for those "keyboard" presses and doing nothing else. Using the simple serial interface on the other hand permits the PC to be used for other purposes with this function in the background.

So if the program runs in the background it won t detect the "keyboard" press but with serial i could send that pushed button notifications until it is reached or how will the program runing in the backg detect the serial message ?
I like the idea of the micro also i used nano in the past, they are cheap and seems to be good quality tho
Seeing the bounce graph of a button make me wonder if there couldn't be any bounce when the button is pressed complete, what is the diferente betwen those cheap and the expensive buttons ? What contact resistance should be ?
I found a nice button here

I should also probably limit the button press amount to a press pe ~ 3 second

Also any time i used a switch i used a pull up / down rezistor to don t get fake reading, but what does the pin mode INPUT_PULLUP does, it is used an internal rezistor?
And why does it conect to digital of the reading is analog 5 or 0v

alex0512343:
So if the program runs in the background it won t detect the "keyboard" press but with serial i could send that pushed button notifications until it is reached or how will the program runing in the backg detect the serial message ?

Generally speaking a USB HID (human input device (e.g. a keyboard)) interacts with the application that is in the foreground of windowed operating system. You can plug multiple keyboards into a computer and typing on any one of them will send characters to the foreground application whatever it might be at the moment. We've probably all had the experience of typing something on the PC and then realizing another window has popped up and our keystrokes are not going to the intended application.

In contrast a USB Serial device is typically claimed by a particular application and any characters sent will go to that application regardless of whether it is on top of the windowing system or not. For instance one can have the Arduino serial monitor or serial plotter in the background happily scrolling incoming data while simultaneously editing a program in the Arduino IDE as the foreground application.

Strictly speaking these behaviors are functions of the PC Operating System components and could be changed, but one generally doesn't want to go there for application programming.

All Arduino boards that have USB can do USB Serial communications. A limited number of Arduino boards that have USB can also be configured to do USB HID communications.