need help for anemometer code in c

General discussion on mikroC.
Post Reply
Author
Message
jay_f1983
Posts: 8
Joined: 18 Jan 2008 18:22

need help for anemometer code in c

#1 Post by jay_f1983 » 18 Jan 2008 19:25

hi guys, i really need your help, i need a code for digital anemometer, im using reed switch, im having problem with the right code, i have to display it to a LCD.......pls help me with this.

pwdixon
Posts: 1431
Joined: 13 Apr 2005 11:14
Location: UK

#2 Post by pwdixon » 19 Jan 2008 00:47

You probably won't get much of a response to this unless you give more details of what you are trying to do like a circuit diagram and maybe some info on the sensor you want to use. You might also suggest what PIC you'd like to use as it does change your options.

In general I guess your application will involve either a fast loop counting sensor transitions or an interrupt routine counting transitions and a timer counter so that the number of sensor transitions/time can be detected.

Then if you look at the examples you will find a suitable display interface application that you can modify to display the anemometer rate.

jay_f1983
Posts: 8
Joined: 18 Jan 2008 18:22

#3 Post by jay_f1983 » 19 Jan 2008 11:15

Actually im using a PIC16f877a , i connected my 20x4 LCD at Portb using only 4bits and i had connected 1 reed switch at RB1 for my anemometer, to detect or count pulses like rpm, 8 reed switches on all portd pin, for the directions, which is north, northwest etc... i had also connected lm35dz at RA1 for adc temperature sensor and another 1 reed switch for the rain gauge, we have this project wich is a PIC-based personal weather station via sms, we are going to connect a SE T290 cellphone to the rx/tx of the pic so that the data can be sent as text message.....hope you can share any ideas that we can use for our project, thanks for the reply by the way....

jay_f1983
Posts: 8
Joined: 18 Jan 2008 18:22

#4 Post by jay_f1983 » 19 Jan 2008 11:29

this is the picture of my cicuit

Image

Image

pwdixon
Posts: 1431
Joined: 13 Apr 2005 11:14
Location: UK

#5 Post by pwdixon » 19 Jan 2008 16:57

Looks like you pretty much have everything in hand, just code from now on.

I would think the most difficult bit would be interfacing to the phone.

Are you going to sms on command from the phone (somehow) or are you going to just send sms messages every so often? Then of course what will you put in the message, I assume either averaged or current readings. If it's current reading then they will be pretty much useless as they will be open to so much short term variability.

You'll certainly want the raingauge on interrupt as I assume it's a tipping bucket mechanism, miss it and your readings are right off.

You could use an interrupt on the anemometer too as these things often go at quite a rate.

You might want to rethink the LCD port because the only interrupt-on-change inputs are on the later bits of portB.

Just out of interest, is this a school project, a hobby, or are you hoping to sell this thing?

jay_f1983
Posts: 8
Joined: 18 Jan 2008 18:22

#6 Post by jay_f1983 » 21 Jan 2008 15:21

what I planed to do in interfacing with the cellphone is that I will use AT commands, the concept is that when i text a code then the cellphone will automatically reply with the current reading and yes i was hoping for the current reading, I was think maybe i could save it to its Eeprom with delay, so that i can acquire it easily by using usart, (i hope thats possible), I tried using PIC18F458 but I was having difficulties on how to make the portd as input, but right now my concern is to run all four sensors first before i go to the cellpone part because its our preliminary defense this 24th, and by the way, this is for our project at school, for our project design subject, this is the only project proposal that was accepted by our instructors because some of what i have proposed are already existing (as what they said)...

pwdixon
Posts: 1431
Joined: 13 Apr 2005 11:14
Location: UK

#7 Post by pwdixon » 21 Jan 2008 16:54

You will need to average the current readings as they will look funny otherwise.

I've used the AT command set on modems but not on cell phones, I imagine it's pretty easy to talk to the phone. I'm not so sure how you are going to get it to answer a text message and then do something in response though. Probably a lot easier to get the phone to make a call out periodically, that's what I'd do first to prove the system then worry about responding to an incoming sms later.

jay_f1983
Posts: 8
Joined: 18 Jan 2008 18:22

#8 Post by jay_f1983 » 22 Jan 2008 15:52

i guess my first aim is to be able to display the current readings in the LCD so that we can just show what are our progress report, after tha we will going to focus on the cellphone interfacing.... :roll:

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: need help for anemometer code in c

#9 Post by IvanJeremic » 20 Nov 2023 08:32

Hi,

Can you tell me what compiler and what MCU you are using?

The more information the better, a schematic of your setup would be helpful.

Regards,

Ivan.

Post Reply

Return to “mikroC General”