I wondering how hard it would be to setup a board and software that just does a time and date stamp when one input turns on and again when another input turns on. then hopefully can be downloaded as a text file maybe.
any help would be great.
I wondering how hard it would be to setup a board and software that just does a time and date stamp when one input turns on and again when another input turns on. then hopefully can be downloaded as a text file maybe.
any help would be great.
Welcome to the forum
Your topic has been moved to the Project Guidance category of the forum as it us more appropriate for your question
The answer to your question is that it would not be difficult for someone with the relevant hardware and software experience
How much experience do you have in those areas ?
Two ways to approach
If the Arduino remains attached to your computer, use Serial Monitor and just log each input change there. Really, very simple to do this, and maybe just start there anyway, to gain experience with hardware and Arduino
Or, if the Arduino will be separate, add a button to trigger an "upload" of events to the computer via serial. This will be more involved.
it's going to have to be the second one as the board will be tucked in a panel of a machine.
I have experience with other software and systems but not much with Arduino.
It might help if you explained the application and what problem you are trying to solve.
How much data do you expect to need to transfer and how often ?
You would need to give the Arduino the ability to know the time. There are several ways to do that including connecting an RTC (real-time clock) module, getting the time from the internet using NTP (network time protocol) or from GPS satellites. RTC is probably the simplest of those for a beginner, but if the Arduino will have internet access, NTP can also be very simple.
You will need to give the Arduino some way to store the data it is gathering in a way that allows you to download it later to a PC/laptop. Most Arduino do not have the ability to store large amounts of data, out of the box. One solution could be to add an SD card writer module. You could then remove the SD card when you want to download the data and use the SD card reader in your PC/laptop. Another way would be to transmit the data to a server in real time, using ethernet or wi-fi. You can then access that data from your PC/laptop without needing to access the Arduino.
So basically what we are trying to do is have a board inside one of our machines that when two outputs trigger on the PLC (24 volt DC which i can easily knock the volts down if needed) it logs the times so it can be reviewed later.
more detailed example would be. output one turns on and the Arduino board see the input and logs the time then when output two turns on it logs that time, and it just keeps doing that over and over storing them in a file as hopefully a .txt or something standard that can then be downloaded and reviewed later.
logging in via WiFi would be great if easy enough to do.
Do both inputs return to the initial state, so that means time to rinse and repeat?
A goes up, time noted. B goes up, does A matter?
Then what, like A and B eventually go away, or might B come and go whilst A is still active?
Words. Maybe a timing diagram would help make the code as simple as it can be for this.
It sounds like you know what to do with the 24 volt PLC logic level. Here it is often recommended to use an optoisolator for the translation between PLC and regular 5 volt logic. It would be the least likely to cause any trouble on either side.
a7
yes, they go high for maybe a maximum of ten seconds then go back to zero. and the intervals between would be minutes if not tens of minutes.
it would hopefully be a case of A triggered at X time then B triggered at X time. it is possible for A and B to trigger at near the same time but i would like them to log separately.
so basically something like:
A trigger B trigger
9:21am 9:34am
9:38am 9:52am
10:02am 10:15am
If you want to connect to the internet then maybe a D1 Mini:
will do what you want.
When I first used the ESP8266 I read this tutorial to get started:
https://tttapa.github.io/ESP8266/Chap01%20-%20ESP8266.html
There is a very good tutorial about running an NTP clock here:
https://werner.rothschopf.net/202011_arduino_esp8266_ntp_en.htm
In terms of inputs and doing what you want the ESP8266 is easily capable of doing what you need.
OK.
It appears the simplest logic would be to notice and log a transition from low to high, or whatever you call going active, from either A or B.
There doesn't seem to be any need to wonder or care about the order, or whether they overlap. At least for now.
I would recommend a step by step approach no matter your skills or experience.
I started to write out the steps, too many and/or I am too lazy… just get each part that goes into this tested and working all by itself with simple sketches or example code you did not write or mess with.
RTC, optoisolators (or however you choose to bridge that gap) and the SD card all separate, functioning alone and understood well enough to start combining them.
Wifi last, if ever. And again, start with simply getting anything over the air to where you want it to land, like "Hello World".
Fold that in and you are done.
I cannot count how many times we see a conceptually simple project presented here as a huge pile of code that is supposed to totally solve the entire problem, but that does not work, with the inquirer at a total loss as to what is in front of her and why it doesn't, if indeed the code even compiles.
Don't make that mistake and you could easily finish this in time for Hallowe'en. ![]()
a7
You may also get some mileage and be able to postpone making purchases that might turn out to be wasteful by doing nearly all the code development in a simulator.
is currently the best, IMO, and has all the parts you need to work with, at least up to the wifi point - and maybe even through the wifi, I haven't looked hard for wifi simulation. But that's the last step, at which point everything else should just work.
![]()
HTH
a7
I grabbed ten minutes and created a sketch and wiring for version -1.0.
Play with it here
// https://wokwi.com/projects/377058695553489921
// https://forum.arduino.cc/t/a-maybe-special-kind-of-setup/1172751
const byte signalAPin = 7;
const byte signalBPin = 6;
# define PRESST LOW
void setup() {
Serial.begin(115200);
Serial.println("Hello World!\n");
pinMode(signalAPin, INPUT_PULLUP);
pinMode(signalBPin, INPUT_PULLUP);
}
void loop() {
bool signalA = digitalRead(signalAPin) == PRESST;
bool signalB = digitalRead(signalBPin) == PRESST;
if (signalA) {
Serial.println("I see signal A asserted");
}
if (signalB) {
Serial.println("I see signal B asserted");
}
delay(100); // spam mitigation act
}
This is so the printing will happen when the signal changes from, say, absent to present, not when the signal is present.
Or as expressed 1000 times per week on these fora, "when the button becomes pressed, rather than because it is pressed".
You may have a similar concept in PLC land.
In the IDE, see the sketch at Files/Examples/02.Digital/StateChangeDetection.
Also, there is google
arduino state change transition
and Arduino themselves have a page devoted to it here:
state change or edge detection
There is nothing in what I've written so far that will not be absolutely worth the time it takes to come to grips with - one might argue that you will need to do in order to get to the next steps.
HTH
a7
Wow, thats awesome. Thank you I will try to figure it out.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.