Shop OBEX P1 Docs P2 Docs Learn Events
Expert coder needed — Parallax Forums

Expert coder needed

computer guycomputer guy Posts: 1,113
edited 2008-12-01 11:29 in Propeller 1
Hi everyone,


I will try to describe this as best I can.

I need someone who can write an object for the propeller that can do the following.


1. Store a schedule in a serial EEPROM connected to pins P26 and P27.

2. Load all schedule data into a comparable format (e.g. an array).

3. Compare the start time in each schedule to the current time (from a DS1302 RTC).

4. If the times match, call a private function.

5. At the end time (after duration), call another private function.


The schedule will contain the following data.

1. Start time

2. Duration

3. A number between from 1-8. **


** This is for an irrigation controller and therefore the valve number to control will be stored in the schedule.

I am sure that this object would be used by lots of people ofr various different projects.
I would write the code myself if I could.

Thank you smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
If you like my avatar then check this out Propeller Domed Sticker

Post Edited (computer guy) : 2/14/2008 6:33:32 AM GMT
«13456

Comments

  • rjo_rjo_ Posts: 1,825
    edited 2008-02-01 05:31
    howdy,

    Most of the time requests like this don't produce anything, but it doesn't hurt to ask. I know that you think you can't do this, but I'm betting that you can... with the right help... which is in plentiful supply around here.

    I have a few questions... and a few suggestions.

    Where are you in the process of learning Spin?

    How many start and stop times do you anticipate needing? It is possible to store such data in your program.

    The prop can be programmed to keep time all by itself, why complicate your life with an RTC?

    Rich
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 05:36
    The RTC is for accuracy.

    I am storing the schedules in EEPROM so that they survive a reboot and blackouts.

    I basically need to say-

    Turn on valve 1,4,5 and 7 at 2:30pm for 30min.

    So the RTC will be used for the time, and to help with accuracy in the duration.



    I know the basics of spin e.g. INA, OUTA, DIRA, IF, ELSE.

    Would be happy to write it myself if I can get enough help.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • rjo_rjo_ Posts: 1,825
    edited 2008-02-01 05:52
    OK... got it. I promise you will get more help than you could possibly need[noparse]:)[/noparse]

    By the way, if you will register for the unofficial Propeller expo, everyone will be a lot more helpful[noparse]:)[/noparse]

    You don't need the real time clock... you just need to occasionally write your time to the eeprom. AND there is a function for this... but of course I don't know where it is.
    For a schedule like you describe you can store all of that in your program and simply read it in when you need it. The whole thing will fit in a single program...so you don't really need much of an object structure.

    Do you have your valves working the way you want them?

    Many people can't really discuss their projects so they talk about a functional equivalent. So, if you stick to the idea of the RTC, I will assume that you have a commercial application, which you can't discuss... which will get you professional support here, but if this is a hobby application and you try to make it look like a commercial app... you will lose favor with the coding gods[noparse]:)[/noparse]

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2008-02-01 05:54
    oh... and one more thing. This really doesn't require an expert. You are probably one or two steps away, but don't know it.

    Rich
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 06:00
    This is a hobby project that may turn commercial depending on how well it works.

    I have a circuit that will switch the valves on from a propeller pin.

    From what I have read the propeller isn't really accurate with keeping track of time.
    Also if the prop was to reset, wouldn't the time be lost.
    These are the reasons for the RTC.

    I am planning on adding more functions to the project in the future, like a rain gauge and soil moisture sensors.
    So an object would be more organised and work better for me.

    I would like to come to the expo, however living in Australia kind of limits my ability to go there.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 06:02
    Have a look at femtobasic for some eeprom routines

    Steven
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 06:20
    stevenmess2004,

    Thanks, I had a quick look at the femtobasic eeprom routines and I like the idea of using this as a method of writing to the eeprom.
    However my lack of coding knowledge makes it impossible to use it.

    I need something that I can say.
    do
    Checkschedules
    if (schedule1 == true)
      if (valve1 == true)
        OUTA 1 ~~
      else
        OUTA 1 ~
      if (valve2 == true
        OUTA 2 ~~
      else
        OUTA 2 ~
    repeat
    
    



    edit:

    I would be happy to write an object to have these function in it.
    However a lot of help would be needed.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker

    Post Edited (computer guy) : 2/1/2008 6:26:45 AM GMT
  • rjo_rjo_ Posts: 1,825
    edited 2008-02-01 06:21
    Actually the Prop is very, very accurate with keeping time. There was a thread a long time ago, but I can't find it... perhaps one of the true experts could chime in on this issue?

    The only problem is that you would need to store time values to the EEPROM and read it back in on brown out or reset. I'm assuming that brown outs would be relatively transient... but I suppose that they could extend for many hours. With the Prop only solutions (which is the cheapest) someone would have to monitor the system every once in a while, but you could have a little screen with the current time on it to know that the system was ok.

    I don't like the RTC for applications like this because I am under the assumption that it requires a separate power supply (usually a battery) and if that gets disrupted you are kind of screwed. If you are dedicated to having an external clock so that no-one ever has to do anything to reset the time, consider going with the Parallax GPS...it will give universal time. And if the system is working at all it will be working on the right schedule... The GPS works almost anywhere(I haven't tried it inside a shopping mall or on a train, but it works in basements and inside of aluminum sided houses[noparse]:)[/noparse]

    In terms of sources of info on the RTC... Bean (Hitt Consulting) has the most elegant implementation that I know of. His board only has a couple of pins available, but the RTC is there and he shows you how to hook it up and use it.

    Rich
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 06:33
    Will look into Beans implementation.

    I am using the DS1302 which has been said to be very easy to implement with the prop.
    Parallax actually sell it on their site.

    The GPS it to big and costs to much for a time keeping device.

    even a 1 year battery has to work better than a power pack, Right smile.gif

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 06:59
    So, looking at the spec for the DS1302, you need the following
    -A method to set the initial time - requires a serial object + a method to convert the time to BCD
    -A method to set the schedule in the eeprom - use routines from femtoBasic
    -A method to read the time - requires a serial object
    -A method to check the schedules - you basically did this a few posts back

    Do you want to be able to change the schedule without a PC? If you don't need to then we don't need the eeprom routines.

    Steven
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 07:02
    I am hoping to set the schedules using the serial port.
    Using a Matchport b/g - The wireless version of the XPort.

    steven, Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 07:12
    You may be better off looking at the Xbee modules. They should be easier to use than the Matchport but you would have to get an opinion who knows more about them then me.

    Steven
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 07:15
    I like the Matchport because of the web server.
    Am hoping to add and remove schedules from an on board website.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 07:34
    If you are going to use that, how hard is it to get the time and schedule from the net somewhere?

    Steven
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 08:05
    I might be able to do that, however it would need some human interaction to trigger the request.

    There is already an object in the parallax object exchange for the ds1302 RTC, so that isn't a problem.
    I just need help bringing the ds1302 object and the femtobasic eeprom routines into one object that will do the things I listed at the top of this thread.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker

    Post Edited (computer guy) : 2/1/2008 8:47:57 AM GMT
  • Matthew HayMatthew Hay Posts: 63
    edited 2008-02-01 09:49
    You might also consider looking over Andy Lindsay's Eeprom object in the PE Kit Labs thread.

    http://forums.parallax.com/forums/default.aspx?f=25&m=156644

    I'm barely a beginner at programming the prop, but what you've mentioned doesn't sound that difficult at all.
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 09:57
    Thank you, will do. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 10:07
    How long do you want the schedule to be?

    I'm thinking that we will need to define some kind of data structure so

    'Start time
    Byte hours
    Byte minutes

    'Run time - do you really need this? Just use another point in the schedule to set the output to off instead
    Word runTime 'in minutes- if you only need upto 2 hours then we can just use a byte

    'Which output
    Byte output 'This will allow us to set 8 outputs at each start time, or use it as a command to do even more

    So all that comes to a total of 4 or 5 bytes. So we need to declare an array in the object to hold the schedule
    byte schedule[noparse][[/noparse] (3 or 4 or 5) *scheduleLength]

    If we keep the runtime as a byte then all the data will nicely fit in a long. I think you have to read and write the eeproms by 512 byte pages (not sure) so this would mean that we could fit 512/4=128 events into a single page.

    I'll see what has to be done the the eeprom routines tomorrow. (we could even write the schedule over where the data is in the spin code in the eeprom. this means that we would only have to write the eeprom, not read it. It will automatically get read when the prop resets itself.)

    Steven
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 10:28
    The runtime will be a maximum of 1 hour or 60mins

    Thank you steven. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 11:16
    Matthew, that link is great. I didn't realise that anyone had done an object like that.

    computer guy - the eeprom routines in the link should make this really easy.

    I'll see what I can do tomorrow.

    Steven
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 11:22
    Just to get an idea of time, it is 10:24pm here.
    What is the time there steven?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 11:32
    Its 10:32 pm I'm in Canberra in the lucky country... And I'm about to go to bed. smile.gif Are you somewhere in Sydney?

    Steven
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 11:33
    Deniliquin NSW.
    Didn't realise you where so close to home.
    Go Australia. smile.gif

    Night

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-01 11:35
    Yep, there are a few of us proppers (new word, maybe?) in Aus now.

    Steven (and its really night now)
  • OzStampOzStamp Posts: 377
    edited 2008-02-01 11:39
    C'mon Aussie come on.
    The lucky country alright...
    The land of milk and honey...

    We build a controller a few years ago with a BS2E and a DS1302 RTC chip with charger circuit..
    Something like this is a walk in the park for the Propeller.. you can do this Anthony..


    cheers ron in melbourne..
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 11:46
    Thanks Ron,

    Now you know why I ordered those parts from you.
    Will be getting them in the mail on Monday. Can't wait.

    Thank you for the encouragement. I know I can build the circuit, the code is just a bit to much for me on my own.
    Luckily this is the greatest forum of all time.

    Time for me to go to bed, Will contemplate the laws of time in the morning.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • OzStampOzStamp Posts: 377
    edited 2008-02-01 14:34
    Hi Anthony

    all goods have been posted.. also XPress mail that freebee parcel as well.
    Got lots of stuff in it...

    You owe me a coffee next time down that way on the Honda TA will pop in for a cuppa.

    You need to break down the job into smaller tasks..
    Work on one task at the time... do not look at the whole task.. at the start.

    Do a flowchart.. work tru the excellent code samples by Andy Lindsay (Parallax tutorials)
    There is lots of stuff out there.. it is a matter of getting all the pieces of the puzzle clciked together.
    Learn how to do it .. get your teeth into it..


    cheers ron mel oz...
  • rjo_rjo_ Posts: 1,825
    edited 2008-02-01 14:37
    And remember most of the posters aren't from Australia... but they would like to be[noparse]:)[/noparse]
  • ColeyColey Posts: 1,110
    edited 2008-02-01 19:58
    rjo_ said...
    And remember most of the posters aren't from Australia... but they would like to be[noparse]:)[/noparse]

    Not me!

    I'm happy here in England with the miserable cold and rainy weather, stupid government, high taxes and poor rugby team! tongue.gif

    lol

    Coley
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-01 22:27
    Ron,

    You are most welcome to pop in next time you are down this way.
    Will have the water boiling by the time you get to the front door. smile.gif

    Thank you for the extra parcel, can't wait to see what you sent.
    I am sure it will help allot with this project and possibly projects in the near future.

    With the help of steven I should have this up and running in no time at all.
    Will put together a flow chart.
    Might start with writing the schedule to EEPROM.
    If that works ok, we will then move on to the next stage.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
Sign In or Register to comment.