Before I invest in Arduindo I would like to determine what I need. I have a intrusion alarm system that provides both HI and LOW logic outputs. What I want to do is capture the date and time of the intrusion(s) and save to a SD card. The Arduindo will not be connected to my PC while in operation. I assume I will need RTC, but I don’t know how to trigger it to make a data file. Or is there a better way? I have read file creation date and time in sd card ? - #5 by cattledog - Project Guidance - Arduino Forum
Writing code is not new to me, but I have not done it in Arduindo. Your assistance will be greatly appreciated.
Before we invest in you, we need to know your background (hardware software) and full project requirements.
Number and kind of inputs (5v/3.3v/dry contacts), time resolution etc.
Seriously, an RTC like DS3231 can be read to get the time when an event occurs.
Example, when a switch changes state you read the RTC.
You open your file on the SD card and write the formatted pertinent information to it.
The SD card can be read by the PC, perhaps a word processor or spreed sheet.
If you are familiar with writing code, learning C++ using the Arduino IDE should not be too much of a challenge for you.
I am working on the same thing. it started out to be a doorbell. then it occurred to me that I really need an annunciator to tell me when someone enters my driveway ( 400 feet ) and my yard ( 50 feet )
then it occurred to me that a GPS and SD card can be had for chump change. So I added a GPS disciplined clock to make it a datalogger.
where I am at, at this minute:
- the doorbell I started with. more later.
- A GPS datalogger with an infuriating fraction of a second lag behind NTP time.
- it uses local time as a filename, so I only have to log HH:MM:SS and sensor number.
- soon: an 8 channel relay, which will be used to route a selected camera to the big monitor in the middle of the vast glass monitor wall, so if Outer Marker Sensor 1 gets tickled I see CCTV channel 32, Driveway Entrance, without needing to switch.
it took 6 months to whip it into the shape it's in now. then I had my fill of plugging one wire into a connector after it popped out and pulling three more out when I retracted my fingers. It was time to hard mount the hardware. I ran into Analysis Paralysis ( is this really the best mounting material? what connector for what task? ) and it took a year and a half to hard mount it. I'm back in the game now.
about that doorbell: I wanted a doorbell that says anything but "ding dong". what I came up with was two doorbells: a visitor doorbell in plain sight for random strangers ( approximately 200 innocuous sounds; animal sounds, TV themes, et cetera ) and a concealed doorbell for people who know me and get me ( the button is in a decorative chicken, where the eggs come out ) Over 312 obnoxious sounds and looking for more: movie quotes, cartoon characters, rock and roll.
14 alarm channels available, 14 more easily added. two channels for the doorbell.
the alarms:
Ch1 Outer Marker 400 feet 20 seconds if you drive it like you own it. one very long bong, chime, whoop, honk - about 20 seconds
Ch2 Inner Marker 50 feet 30 seconds for the driver to park, get out, walk up to a gate. two fairly long chimes, gongs, et cetera
Ch3: Curtilage. enter the gate, three notes. The NBC chimes are my favorite
Ch 4: reserved for the neighbor on the same property
Ch5 - 9: places people wander where they should not. enter the junkyard, get one of 25 alarm sounds; barking dogs, roaring cats
Chs 9 up: any of a hundred alarming sounds. Many klaxons, fog horns, SciFi sound effects. For people who enter the gravel pit / race track / shooting range.
at this moment the status of the sound system is unknown. the LCD status display shows the file and folder of the sound command sent to the card, the card makes no sound. my next immediate task is find my spare sound cards and swap that out
- It is too big for anything less than a Mega.
- it must have an RTC card - it won't run without it.
- I use 5 LCD modules - File and sensor status, reserved for future use, UTC, Local time, and clock status. UTC because I do ham radio.
- Catalex YX500 sound module
- Neo-8 GPS. Neo 6 works; I require two or more mounting holes.
- Catalex SD card module.
- 8 channel optoisolator, so I can use 12V burglar alarm sensors and illuminated doorbell buttons
the most recent build is attached. use all or any of it, as required.
working on: press the doorbell, get your picture taken. to see who is standing on my front porch, pressing the button, giggling like a goof.
the sound out goes through a 4 channel distribution amp to:
a speaker over the doors
a 70 watt PA
an FM transmitter, so I can have a speaker in any location
when I get the relay working a couple of channels will be used to switch the sound output to the approriate venue.
RPPM_V_0_1_2_1.ino (25 KB)
larryd:
Before we invest in you, we need to know your background (hardware software) and full project requirements.
Number and kind of inputs (5v/3.3v/dry contacts), time resolution etc.
Seriously, an RTC like DS3231 can be read to get the time when an event occurs.
Example, when a switch changes state you read the RTC.
You open your file on the SD card and write the formatted pertinent information to it.
The SD card can be read by the PC, perhaps a word processor or spreed sheet.
If you are familiar with writing code, learning C++ using the Arduino IDE should not be too much of a challenge for you.
At 9 years old I was building crystal and tube type radios. I progressed thru ham radio and owning my own business building "two way" radios for boats, taxis and the like. I was employed for 3 years at Collins Radio Company testing communication and navigation radios for aeronautical and marine use. I also worked there on space program communication equipment. Later I worked at Ingalls Shipbuilding in various positions, including the replacement of the old computer system with Oracle. I also created many utility programs using Microsoft office suite, Basic, batch files, VGA etc. I also worked for the Stanwick Corporation on their contract with the Navy for upgrading electronics at various Navy and Marine core air stations. I am now 81 years old.
Thank you for asking.
As to my current project, I merely want to record the time some one walks thru the light beam of the alarm system. I don't need to write from the PC to the SD card, just read the card after I return from a trip.Thank you.
Sounds like you fit in here nicely ![]()
What exactly do you need immediate help with.
As to my current project, I merely want to record the time some one walks thru the light beam of the alarm system. I don't need to write from the PC to the SD card, just read the card after I return from a trip.
Okay.
Let’s say you have a N.O. micro switch near the doors edge, when the door is opened the contacts of the switch close.
The switch maybe wired as S3 in the following image.
Your sketch is written such that the switch is sampled every 50ms for a change in state i.e. from open to closed then closed to open.
When you detect the switch closing, you read the DS3231 RTC for time and date and let’s set a doorFlag equal to true (normally it is false).
The code in loop() routinely monitors our doorFlag regularly and when we see the flag = true we execute a function that then writes the RTC time/date we captured above to a file on the SD card. see examples on how to write to an SD card.
We then set the doorFlag to false and continue normal code execution.
Or, we can just write to SD card when the switch closes without using a flag.
Things repeat over and over as loop() executes.
Of course, the switch can be replaced with a PIR etc.
OK Sound good, but if the switch writes directly to the SD will it timestamp without the RTC?
“OK Sound good, but if the switch writes directly to the SD will it timestamp without the RTC?”
Don’t understand what is being said here.
You really do need an RTC to recover from inevitable power disruptions.
Okay. Thanks. I think I got it now. Your help is much appreciated. I may even take a look at doing a serial readout so I can just push a button to read the event times and not have to remove the SD for reading with the laptop.
Again, thanks.
Before buying an Arduino board and a (micro)SD module, please tell us what you want to buy.
There are many SD modules that have very bad sockets with bad contacts, or modules that require software toggling the pins because they have no SPI bus, or modules that convert 5V signals into 3.3V signals in a bad way.
If your alarm has 5V signals, then it might be easier to use a 5V board. There are "data logging" shields with RTC chip and (micro)SD sockets.
If your alarm has relay output or optocoupler outputs, then you can choose from all the Arduino boards.
The Arduino MKR ZERO has it all.
A MKR board with SAMD M0+ processor together with "Arduino MKR Mem Shield" is also a good choice, but not cheap.
The SAMD M0+ processor have a RTC in the processor. This is the explanation: RTCZero - Arduino Reference
When you want to connect to Wifi, I suggest to step outside the cosy Arduino nest and use a ESP32 in Arduino-compatible mode.
It is always good to have a simple Arduino Uno (clone), just to try things.
Thanks for the info.
I have ordered a Arduino UNO R3, RTC and SD card modules. Also ordered the A6 GSM/GPRS module as Wi-Fi connection is marginal. The alarm (light beam) sensor has both high and low logic outputs (12 volt). The high pulse will trigger a programmable timer in “retriggerable one-shot” mode. This will send power to the siren for 3 minutes and then reset. The Arduino is to capture the event time and send a text message to my flip phone. The alarm system will be armed / disarmed by a RC remote control. I intend to wire one of the key fobs to the Arduino to arm / disarm upon receipt of the applicable text message. Having the time stamp on the SD card will enable me to correlate with the images recorded by the motion detector camera. The camera produces a plethora of images due to moths and bugs and other UFOs. The camera has no Wi-Fi, just SD card. Alarm status will also be handled via text message.
