Can anybody help with programming in Arduino IDE

Two on Tour

LIFE MEMBER
Joined
Sep 16, 2016
Posts
10,889
Likes collected
56,726
Location
Near the junction of the A14 and A1, Cambs
Funster No
45,145
MH
Elddis Autoquest 175
Exp
Since 2010
If our MH alarm goes off and we are out of earshot then we have no idea that it is going off until we get back to our van.
What I'm trying to do is program a Wemos D1 mini ESP8266 board along with a KY-038 sound sensor module to send me an SMS or email via our onboard MiFi in the van if the alarm goes off. I was looking to have the Blynk app give me the notification, but thinking that this may just complicate matters.
I'm in the early days of playing with Arduino IDE and ESP development boards plus it's trying to teach an old dog new tricks.
The most advanced thing I have managed to do at present is to program an ESP32 board to operate a servo to adjust the opening and closing of a vent on the ducting of our diesel heater via the Bylnk app.

I would welcome any help and guidance with the coding and an accompanying explanation of the coding.
 
Joined
Feb 27, 2011
Posts
15,242
Likes collected
80,978
Location
UK
Funster No
15,452
MH
Self Build
Exp
Since 2005
Does your alarm not have an auxillary output? If so then using this would be better than a sound sensor.
Or if not, is the siren a straight 12v supplied one? If so then a solid state relay across this would give a more reliable trigger. Do not connect the arduino directly or even via a voltage divider to the alarm directly as it may affect the operation.
A solid state relay is unlikely to have any effect on the operation.
 
OP
OP
Two on Tour

Two on Tour

LIFE MEMBER
Joined
Sep 16, 2016
Posts
10,889
Likes collected
56,726
Location
Near the junction of the A14 and A1, Cambs
Funster No
45,145
MH
Elddis Autoquest 175
Exp
Since 2010
Does your alarm not have an auxillary output? If so then using this would be better than a sound sensor.
Or if not, is the siren a straight 12v supplied one? If so then a solid state relay across this would give a more reliable trigger. Do not connect the arduino directly or even via a voltage divider to the alarm directly as it may affect the operation.
A solid state relay is unlikely to have any effect on the operation.
Thanks for your reply Karl.
The sounder and alarm module for our Autowatch 695RLC is tucked away up against the firewall and windscreen scuttle keeping it out of the way of thieving hands that may try to disable it, hence in looking at the noise of the alarm sounding to trigger a digital high on the KY-038.
I have watched an Italian guy on Youtube in Italian and not too much detail, setting up and using a Wemos D1 mini and a KY-038 to alert him on his mobile through Home Assistant when his doorbell is rung when he is in his workshop and out of earshot of his doorbell, so I know it works and appears reliable at lower sound output than our van alarm.
If I get a notification that the van alarm has sounded, I can then access the PTZ camera in the hab area to see if anything is going on or a false alarm.
 
Joined
Sep 17, 2017
Posts
6,296
Likes collected
12,077
Location
Birmingham, UK
Funster No
50,575
MH
A-Class
Exp
2017
Is MicroPython a better option? It's easier to code, as long as the components are supported.

Other consideration is power. Leaving the MiFi and an ESP on all the time only eats a few watts, but it adds up over the day.
 
OP
OP
Two on Tour

Two on Tour

LIFE MEMBER
Joined
Sep 16, 2016
Posts
10,889
Likes collected
56,726
Location
Near the junction of the A14 and A1, Cambs
Funster No
45,145
MH
Elddis Autoquest 175
Exp
Since 2010
Is MicroPython a better option? It's easier to code, as long as the components are supported.
Never looked at MicroPython, but I did note that the ESP boards have to be flashed with the MicroPython firmware to use them.
I'm only just starting out on Arduino, so at present, I'll stick with one thing at a time or my poor little brain will explode.
I know both the ESP boards and the KY-038 are supported by Arduino.
The last bit of coding I did before this was a bit of Visual Basic 30 years ago.

Other consideration is power. Leaving the MiFi and an ESP on all the time only eats a few watts, but it adds up over the day.
Only intend to power up the ESP when we leave the van when we are away, otherwise our van is parked up ten yards from our back door when at home.

Subscribers  do not see these advertisements

 
Joined
Feb 27, 2011
Posts
15,242
Likes collected
80,978
Location
UK
Funster No
15,452
MH
Self Build
Exp
Since 2005
MicroPython vs native (c like) arduino language is an easy one.

If you have had any experience with Python but none with C then use MicroPython, otherwise stick with the default Arduino C language.

The default language of arduino has so many examples, tutorials and code repos that it would be harder to move to micropython.

Personally I don't like Python as a language as I prefer {} structuring rather than indent structuring. indents make it too hard to read for me. But that is a personal choice.

I would only really use Python languages if I was doing any AI stuff again especially on the Raspberry PI.
 
Joined
Feb 27, 2011
Posts
15,242
Likes collected
80,978
Location
UK
Funster No
15,452
MH
Self Build
Exp
Since 2005
Agreed on disliking the idents for Python. Horrible idea!
I wouldn't say it's a horrible idea. I have just had over 30 years of using {} structure and I am too old to change and don't need to change :)
 
Joined
Feb 27, 2011
Posts
15,242
Likes collected
80,978
Location
UK
Funster No
15,452
MH
Self Build
Exp
Since 2005
I don't understand the hatred. It's far easier than chasing braces. Especially when everyone indents their code anyway.
I don't hate it. I am just trained/accustomed to using braces and seeing braces.

Braces make it clear where a block starts and ends. You don't have to worry if your indents are correct, or if they use tabs or spaces.
Without braces, it would be possible to get into a right mess with indents in a larger block of code. Avoidable sure, but needs experience.
The braces make it clear and help you with ensuring indents are in the right place for readability.

Subscribers  do not see these advertisements

 

Join us or log in to post a reply.

To join in you must be a member of MotorhomeFun

Join MotorhomeFun

Join us, it quick and easy!

Log in

Already a member? Log in here.

Latest journal entries

Back
Top