Help with Alert Routine please

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Help with Alert Routine please

Post by acestu »

Hi,

I want to build a system of a temperature sensor that monitors the temperature of water in a tank and alerts a mobile phone via a text message if the temp goes above or below a certain temp, I will be using a small 800L gsm board and I have put together a small test program for the unit, what I need to know really is how best to control the alert ie I will have to implement some sort of condition that has to be checked before the text message is sent otherwise I suppose the gsm unit would just keep sending text messages over and over when I would just want to be notified once , I hope this makes sense

EDIT: Would I have to add a ds1307 to be able to tell if an sms has been sent in the last 1 or 2 hours ?
800L_Test_d.fcfx
(9.23 KiB) Downloaded 627 times
Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Hi Acestu,
I have two flags installed so at too high or too low only one SMS is sent. Whether you want to send a SMS when reaching the normal state, is up to you. I installed it a try.
With DS1307, the logger can be expanded. You then send by the time the SMS.
Tiny
800L_Test_d_1.fcfx
(11.25 KiB) Downloaded 660 times

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi tiny,

Thanks for your reply, I have downloaded your modified chart, It is a way of doing it but the flag is only going to be reset if the temp changes to in between the upper and lower limits which could be a long time, I was really hoping that I could have a time based solution, I was thinking more of an internal timer, I downloaded a pic timer calculator but after putting my settings in several times it just kept saying "Not Possible".

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi,

I have tried to make a chart converting a Flowcode5 chart from a while ago , any pointers would be appreciated..

Thanks
Stuart
800L_Test_e.fcfx
(12.91 KiB) Downloaded 580 times
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Hi,
here is a proposal with recurring timer, adjustable to 60 hours repeating when a limit is over or undershot.
Tiny
800L_Test_e_1.fcfx
(17.61 KiB) Downloaded 636 times

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Hi,
as you mentioned here a version with RTC and time stamp for the event. The first message is instantaneous, each additional message delay (adjustable), but with the original event time.
Tiny
800L_Test_with_TimeStamp.fcfx
(36.04 KiB) Downloaded 653 times

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi tiny,

Wow, thank you so much for taking the time to do this, I will set it up on a breadboard and get a sim card so that I can test the gsm unit.

cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Gladly, I had partly finished macros of my projects.
Tiny

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Tiny,

In the time stamp version, do I have to call the RTC_Init macro somewhere in the main macro so that it sets the time and date, and I think I have to incorporate something so that the time doesn't reset after a chip restart don't I ?

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Hi Stuart,
the RTC_Init macro is for the first time to sync the RTC with actual Date/Time or adjust the date and time when the clock is off. The RTC is battery buffered since nothing is lost as long as the battery is ok.
For the first time to initialize using a keypad and the Display to set the clock, then the routine is no longer needed.
I had a I2C-display with connection for a 16 button keypad used in an older project.
It is, of course, with a parallel keypad, but I think they are certainly routines in forum available.

Tiny

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Tiny,

I have added an eeprom and a routine that runs the rtc_init macro only once, is this correct ?

Thanks
Stuart
800L_Test_with_TimeStamp_c.fcfx
(37.51 KiB) Downloaded 611 times
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Hi Stuart,

in principle, yes, but the routine for first setting the RTC to the proper date / time values should not be dependent on an EEPROM value, but should be carried out manually.
There are excellent posts here in this forum. One I like particularly, and the routine with keyboard and display for describing the RTC is also good.

http://www.matrixtsl.com/mmforums/viewt ... ds1307+rtc

Tiny

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Tiny,

I think I know what you mean, you are saying build a separate circuit to program the RTC, and then just wire it up to the i2c lines on this project, I just got a little confused because there is no call anywhere in the chart for the RTC_Init macro so I wondered if there should be.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Help with Alert Routine please

Post by medelec35 »

I'm in the middle of creating a blog that uses one microcontroller to set and display time.
What makes it so special is I will be posting an application file which sets the RTC Hours, Minutes Seconds, Day, Date, Month & Year with current PC time by just clicking on a button.
Takes less than a second to set all values.
If your interested I can let you know when the blog is ready.

Martin
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Martin,

That sounds like a nice little tool, would love to have a go with that, I am just about to build your DS1307 programmer actually, I remember reading the article some time ago and I bought a couple of each type of the clocks.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi,
I have never undertaken a project like this before as I now have mixed voltages as in the chip is 3.3v , the display is 5v, the sim800L is 3.3v, now the 800L I am told can be connected directly to the microcontroller but what about i2c line from and too 3.3volts and 5volts ?, any info would be appreciated.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Hi Stuart,

the easiest way is via resistors. The input (Rx) of the GSM module must be performed via a resistor to the MCU (Tx), the output (Tx) of the GSM module can be connected directly to the MCU Rx.
Here is an example from the Internet:
gsm-modem-7-728.jpg
(78.5 KiB) Downloaded 12249 times
Only Rx and Tx connected, no handshake. Works, I have in my circuits no handshake. PWON can / must not be connected..

Tiny

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Tiny,

Thanks for the diagram,
the Flowcode gsm module only has connections for Tx and Rx there is no Pwon connection, and on my 800L gsm module connections are:

RING,DTR,MICP,MICN,SPKP,SPKN,NET,VCC,RST,RXD,TXD,GND

so it too has no PWON connection, I am having a bit of a battle with the suppliers of the board at the moment as they didn't supply the datasheet when I bought them and it's like getting blood out of a stone, ironic really because the reason I bought them is because I had no datasheet for the sim900a board that I already had, I have searched the internet but can't find anything for the 800L mini board.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Help with Alert Routine please

Post by tiny »

Hi Stuart,

the Minimum wiring is VCC (3.3V), GND, Tx and Rx. PWON is here only as an example at the diagram. More than four connections are not needed for GSM. Some ports you listed are intended for voice call.
Connections are described on the back of the module, the AT Commands for SIM800L can be found here

https://www.adafruit.com/datasheets/sim ... _v1.01.pdf

Tiny

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Tiny,

Thanks again for your info, I am just waiting for some capacitors to arrive so I can set this up on a breadboard and see if the 800L works with the Flowcode gsm component, the chip I am going to use is a pic18f24J11 and it is quite interesting because it has a real time clock and calendar built in to it.


Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Help with Alert Routine please

Post by medelec35 »

medelec35 wrote:I'm in the middle of creating a blog that uses one microcontroller to set and display time.
What makes it so special is I will be posting an application file which sets the RTC Hours, Minutes Seconds, Day, Date, Month & Year with current PC time by just clicking on a button.
Takes less than a second to set all values.
If your interested I can let you know when the blog is ready.
Just an update.
Blog has now been published including all the necessary files to speed program RTC in just under 2 seconds.
It can be found here

Martin
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Martin,

Thanks for the update, I will have a look now...

Cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Martin,

I had a look at your PC DS1307 programmer, cool project, unfortunately I don't possess the eblocks used in the project.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Help with Alert Routine please

Post by medelec35 »

Hi Stuart,
You don't need to.
You can use any usb to uart converter available from RS Farnell etc.
Any programmer
Any LCD etc.
The Eblocks are just rapid prototyping to get you ready for transition to hardware that's created from scratch
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Help with Alert Routine please

Post by acestu »

Hi Martin,

That's good to know, I will get ausb to uart converter and have a go, I am just trying to build your rtc programmer but I can't get the chip to program.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

Post Reply