Motor On/Off trigger to Arduino

Thread Starter

Nikhil_M

Joined Jan 24, 2022
8
Hello,

I am a beginner at using Arduino.
I wish to do a very simple project.
If a user turns ON a water motor pump, it should give a trigger to my Arduino UNO.
Arduino will note the Motor ON time and date.
If a user turns OFF a water motor pump, it should again give a trigger to my Arduino UNO.
Arduino will note the Motor OFF time and date.
Please help me how can I detect motor ON/OFF and save the data using Arduino.
 

boostbuck

Joined Oct 5, 2017
510
I have a similar issue and provide safe isolation between the 240VAC motor circuit and the Arduino I used a relay.
I connected a 240VAC relay in parallel with the motor and used the contacts to switch a dc signal at the Arduino.
 

dendad

Joined Feb 20, 2016
4,472
Another way to sense the load running is to use a clip on current transformer around ONE wire used to power the motor.
1643014270401.png
Or a fixed one that requires you to thread a wire through it as these are cheaper, but require you to work on the motor mains wiring.

1643014382597.png
Ready made boards for the Arduino are available too...
1643014433184.png

This thread may help...
https://forum.allaboutcircuits.com/...ac-current-sensor-current-transformer.175486/
 

Ya’akov

Joined Jan 27, 2019
9,131
And for a clock, the DS1302 as below...
View attachment 258603
https://www.arduino.cc/reference/en/libraries/ds1302/
https://aidansun.com/arduino/ds1302-arduino.php
All the above pictures were just grabbed from their Ebay adverts.
My experience with DS1307 modules suggests the trimming of the oscillators on inexpensive RTC boards is not particularly good. I get quite a drift over time, on the order of several seconds per month. I found I needed to have some way to set it regularly, and depending on the circumstances, a cheap GPS module is a good option.

I've had good success with this module,

1643018598858.png

but if you doubt care about the USB port (which I find quite handy) you can save a few bucks.

1643018565495.png

They are both using the ublox NEO-6M module. Not the latest and greatest but cheap and cheerful and more than enough for this application.

[EDIT: Belated proofreading, no change to the content just fixing up some oddball wording and autocorrect munging]
 
Last edited:

Dave Lowther

Joined Sep 8, 2016
224
Please help me how can I detect motor ON/OFF and save the data using Arduino.
What voltage is used for the motor? If it's using AC mains then see suggestion(s) earlier in this thread. However, if it's a DC motor there may be a simpler method.
Do you want the stored ON/OFF events to be kept if the Arduino is turned off/on?
How many ON/OFF events do you want to store?
Will your Arduino be used in a location where it could connect to your wi-fi? If so I wouldn't bother with a RTC / GPS, instead I'd use an ESP32 (which can be programmed using the Arduino IDE) and get the time from the internet. The ESP32 also has a lot more flash memory where you could store the ON/OFF events.
How are you going to view the ON/OFF events stored in the Arduino?
 

Thread Starter

Nikhil_M

Joined Jan 24, 2022
8
What voltage is used for the motor? If it's using AC mains then see suggestion(s) earlier in this thread. However, if it's a DC motor there may be a simpler method.
Do you want the stored ON/OFF events to be kept if the Arduino is turned off/on?
How many ON/OFF events do you want to store?
Will your Arduino be used in a location where it could connect to your wi-fi? If so I wouldn't bother with a RTC / GPS, instead I'd use an ESP32 (which can be programmed using the Arduino IDE) and get the time from the internet. The ESP32 also has a lot more flash memory where you could store the ON/OFF events.
How are you going to view the ON/OFF events stored in the Arduino?
Do you want the stored ON/OFF events to be kept if the Arduino is turned off/on?
-Yes the ON/OFF events must be saved even if the Arduino is turned off as I would be calculating the total run hours for the month/year.

How many ON/OFF events do you want to store?
-The number of ON/OFF events are not determined yet.


Will your Arduino be used in a location where it could connect to your wi-fi?
-It will have wi-fi connectivity when in experimentation mode but on field it will have a GSM module.

How are you going to view the ON/OFF events stored in the Arduino?
-The plan is to send the data to cloud and receive it on a PC
 

Dave Lowther

Joined Sep 8, 2016
224
Do you want the stored ON/OFF events to be kept if the Arduino is turned off/on?
-Yes the ON/OFF events must be saved even if the Arduino is turned off as I would be calculating the total run hours for the month/year.
How many ON/OFF events do you want to store?
-The number of ON/OFF events are not determined yet.
Have you decided whether you will be using the microcontroller's internal non-volatile memory or will you be using some external non-volatile memory? e.g. if you are going to have an external micro-sd card then you don't need to worry about limited storage space, OTOH if you want to use the microcontroller's storage then you will need to decide how much memory you need for storing events before you decide on which microcontroller to use. The ESP32 that I use has about 1.3 M Bytes of storage. The Arduino Uno has only 512 bytes.

Will your Arduino be used in a location where it could connect to your wi-fi?
-It will have wi-fi connectivity when in experimentation mode but on field it will have a GSM module.
How are you going to view the ON/OFF events stored in the Arduino?
-The plan is to send the data to cloud and receive it on a PC
I have no experience of using GSM. Perhaps your code at the socket API level (or above) will be portable from WiFi to GSM. Maybe someone else reading this will be able to advise you on this matter. I assume that if you are using GSM for a data link to the cloud then you will also be able to use it to get the time using NTP. If my assumption is correct then you won't need an RTC or GPS to get the time.

You didn't answer this question from my post #6
What voltage is used for the motor? If it's using AC mains then see suggestion(s) earlier in this thread. However, if it's a DC motor there may be a simpler method.
 
Top