⚠️ This forum has been restored as a read-only archive so the knowledge shared by the community over many years remains available. New registrations and posting are disabled.

All times are UTC + 8 hours




Post new topic Reply to topic  [ 167 posts ]  Go to page 1, 2, 3, 4, 5 ... 12  Next
Author Message
PostPosted: Sep 28th, '11, 13:55 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
[Edit from the future - this project has been superseded by PICAXE 20M2 Demand feeder 2.0 Hopefully this one will not only make sense, but might actually work.]


Please, anyone interested in dropping input into this project should do so. I need all the help I can get. Just don't take offence if I don't take up your suggestions :) but please keep them coming
Lots of these ideas come from other people but I dont have time to credit everyone so just call this an open source project for BYAP
----------------------------

*I think it should have a lever under water that the fish press when they want feed so no feed is dumped if nobody is hungry - I've tested this and they work it out on their own within 3 to 5 days

*There should be restrictions as to how often they can press it. with say a delay of 15 minutes or something between feeds.

*there should be a light that tells them if they press it they will get fed to help stop them tapping away at it in frustration when it wont deliver feed because of a limit, and thus help re-enforce the behaviour. (im not sure if fish can see in colour, but it occurs to me that we can find out if we have a 2 colour LED and show green for when they can feed, and red when they cant

*there should be a total maximum amount of feed they are allowed in any one day, 12 hours, or whatever period the user wants to set based on the amount the user decides that their filtration can handle.

*there should be an upper and lower water temperature limit that wont allow any feeding if its outside those limits

*there should be a "water is flowing check" to make sure the system is running normally, and stop feed if, for instance, the pump is off. If this is at the return to the sump or FT, it might aloso serv as an alarm for a leak.

*there should be a "test a full day" button on the device so you can simulate a full days feed, and check to see if its working as you think it should. This could be implemented by running the motor backwards and having the feed come out into bucket on the ground rather than going into the fish tank.

* there should be a warning light to tell you that you are in reverse simulate mode, and another light to tell you that the fish feeding system is in normal mode.

*there should be some feedback method to tell you how much feed your fish have had so far, and a warning of some kind if they have gone off their food for some reason. An inexpensive way to do this would be to have a LED that flashes long and short flashes to indicate numbers of feeds. So Long Long short short short would be 23. I think that would be easy enough to read and you could see it from a distance else where in your yard so might even be better than a LCD screen.

*There should be a button to override and drop a small feed so you can still feed them when ever you want to to show the kids next door or whatever, and this feed should be counted from the days total allowance.

*there should be something to tell you that your hopper is empty. This could be digital, but in my case I run a small system so I would just use a clear glass hopper so I can see what feed level I have.

Can anyone add to that wishlist?


Top
 Profile  
Reply with quote  
    Advertisement
 
PostPosted: Sep 28th, '11, 14:14 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
I tend to work like this...

I start with the words start and end, and run it. Then I fix the bits that didn't work. In this case everything.

I do have a bit of disipline with code in that I try to use subroutines where ever I can so that the main program flow is easy to understand. Sometimes I make simple decisions within the main program flow, but if they are complex, I go of with a subroutine and do them somewhere else.

A subroutine is created by creating a label like say CheckWaterTemp: and then in your code you can call it like this...

Code:

Start:
     
     gosub CheckWaterTemp  'go to the subroutine called "CheckWaterTemp"



End:

'=================================================

CheckWaterTemp:
     
     'add some other code here to check the temperature of the fish tank
     '(a line with a ' in front of it doesnt get read by the programmer when
     'it sends the program to the chip, so we can add comments to help us keep
     'track of what's going on)
     'this code should end by making a variable, like "x" = whatever the
     'temperature is. But rather than using "x" we can name variables something
     'that makes sense.
     'in this case something like FishTankWaterTemp. These variables get converted
     'into something smaller so you can be generous with naming them something
     'that makes sense, they dont get sent to the chip when you upload the program
     'to the chip. They get converted into something like "b3", so even a long variable
     'name wont take up any extra space.
     
Return    'takes the program flow back to the main section, and moves on to the next line.



Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 14:17 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
Its good practice with writing code to make use of white space and indentation to make different sections of code clear.

Also, within the program editor, different kinds of information are in different coloured type.

So when you use a command it might be in blue, and a comment might be in green. This also helps to follow whats going on.

Indentation is usually a tab or 4 to 6 spaces.


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 14:32 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
The other advantage of subroutines is that it allows you to reuse code.

So you might do something like this

Code:
Start:
     
     Gosub IsItOkToFeed
     gosub CheckWaterTemp  'go to the subroutine called "CheckWaterTemp"
     gosub CheckWaterDepth
     gosub IsItOkToFeed       'run that same bit of code again . It saves space, and
                                       'saves errors and conflicts because its all in the one place.


End:

'=================================================

'-------here lies subroutines------------------

CheckWaterTemp:
     
      'do some stuff to work out what the temperature of the fish tank is
      'and then populate a variable with the value so we can use it else where

       let WaterTemp = 27 '
     
Return    'takes the program flow back to the main section, and moves on to the next line.

'---------------------------------------------------

IsItOkToFeed:

     'work out some stuff using if this then that
     'if everything is good and they can feed, set a variable like ...

     let FeedState = 1 'they can have one feed

     'if they have been greedy and have fed too much, set the same variable to something like
     'we would check to see if they have been greedy by keeping a record of how long since
     'their last feed. We would store that in yet another variable

     let FeedState = 0  'they can have zero feeds

return 'takes the program flow back to the main section, and moves on to the next line.


'---------------------------------------------------


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 15:06 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
What all this assigning stuff to variables does, is allows you to compare values against each other.
you also have to tell the system where to store your variable.

There are a few ways of doing this, but with PICAXE, you store variables in things like b1, b2,b3 etc.

So you do something like this...

Code:
symbol WaterTemp = b0
symbol FeedState = b1

Main:

let FeedState = 1   'this populates the variable "FeedState" with the value "1"
                          'and allows fish to feed when you first start the system
                          'because this only needs to be run ones, we can put it
                          'somewhere on its own. In this case we should place it
                          'in a subroutine that I might call "Initialise:"
                         

     Continue:        'the rest of the program needs to loop around for ever
                          'so it keeps monitoring the system, so we can create a
                          'section for that as well. In this case I'll call it continue


     goto Continue  'this allows us to put everything we need to do over and
                          'over again, between the lines "Continue", and "goto Continue"
                          'This creates a loop.

End:                    'this line wont ever get read, but is a good idea to put it in,
                          'because in the event of you writing some wacky code that
                          'exits the loop, it will prevent the program flow from running
                          'into your subroutines and running them as if they were simply
                          'the next thing you wanted to do



Now what all that means is now we have some variables with some values, and we can do things like this...

Code:

symbol WaterTemp = b0
symbol FeedState = b1

Main:

                 

     Continue:

          if WaterTemp > 30
               then let FeedState = 0     'dont feed 
          end if

          if WaterTemp < 30
               then let FeedState = 1     'feed

          if WaterTemp < 10
                then let FeedState = 0    'dont feed

          'there are better ways to do this but that's the general idea
          'you get to compare variables and make decisions and branch
          'the flow of your program based on conditions being met or not.

          gosub LeverPressed 'it can be very powerful when you can now do
                                  'things like this

     goto Continue 

End:         

'---------------here lies subroutines-------------

Initialise:
     
     let FeedState = 1             

return

'---------------------------------------------------

LeverPressed:          'this might be run when ever the fish press the lever
     
      if FeedState = 0
          then return    'ignore the request for food and exit this subroutine
      end if
     
      If TimeSinceLastFeed = 0       'this variable would have to be defined
                                               'at the top in a real program
          then return    'greedy fish dont get fed
      end if

      'write some code to feed the fish because if the code has gone this far
      'they can eat.
     
      'this might be a good place to put the project into a rest mode for a
      'few minutes, because the fish have just fed and are not allowed to
      'have any more for a while.
   
return    'go back to the main program and continue with the next line
     



Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 15:12 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
I dont really know if that code works, because I am just writing it in here. Normally you write some code in the programmer, then either simulate it or upload it to your project and see if it works.

In my case it doesn't, so you go back and find the problem, and fix it.

This is called debugging

There is actually a command called "debug". If you place it in your program, when you upload it to your chip and run it, every time it sees a debug command, it shows all your variables current values, and also shows what the pins on the chip are doing.

I believe debugging is called debugging because some people working on an early computer had a problem where their code didn't work, and it turned out to be an actual real life bug interfering with some electronic thing.

No idea if it's true.


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 15:24 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
If anyone has any ideas on how to implement any sections of the software or the actual physical device feel free to chip in.

I'm very new to this stuff and what I've written so far is pretty much the extent of my knowledge.

I know a bit about reading alalog signals from a pin using the command READADC see ...
PICAXE manual 2

and a bit about the PWM command (pulse width modulation) also in that manual

I've also used a transistor to turn on a motor and control it via a power source other than the chip's

But that's it.


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 16:54 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
By the way the lever pressing thing worked like this...




and my original device looked like this...

Attachment:
120 Things in 20 years - Aquaponics - fish activated feeder top.JPG
120 Things in 20 years - Aquaponics - fish activated feeder top.JPG [ 34.54 KiB | Viewed 9246 times ]


and it had the following features...

String.

Attachment:
120 Things in 20 years - Aquaponics- string feed counter.JPG
120 Things in 20 years - Aquaponics- string feed counter.JPG [ 40.78 KiB | Viewed 9246 times ]


The string would roughly count how many feeds had been delivered.

Roughly :)


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 18:26 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Oct 11th, '07, 19:43
Posts: 6687
Gender: Male
Are you human?: Not at 3 am :(
Location: Kalgoorlie
Man, nice ideas - there is nothing like this that you can buy at the moment, as far as I know.


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 19:04 
In need of a life
In need of a life
User avatar

Joined: May 28th, '10, 15:40
Posts: 1508
Location: Strathfieldsaye Bendigo, VIC
Gender: Male
Blog: View Blog (1)
Are you human?: salmonid
Location: Bendigo - Central VIC
:headbang: :headbang:

Thats awesome !


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 19:08 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
It doesn't work yet :)


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 19:21 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
Feel free to get involved :)

if you have no interest in the code or electronics side, there is always PVC delivery pipe and hopper design.

I think the wood drill bit works pretty well for that part of the delivery system, but there might be a better way.

One thing I did find useful was the use of a plastic tube between the motor, and the drill bit. It acts like a uni-joint on a car, and allows some room for error in alignment between the two. I'm guessing it would last for as long as the plastic tube would last so I'm thinking a thousand years or so :)


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 19:30 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
Outbackozzie wrote:
Man, nice ideas - there is nothing like this that you can buy at the moment, as far as I know.


Lots of those are other peoples, pete from pickaxe with the light that says they can feed, someone I cant remember from both here and there for the light that counts out numbers (sorry I cant remember who - wave if it's you) TC for temperature restrictions etc etc etc sorry I should take notes.

Chip in with any things you think this thing should do. It's easy to make it do stuff.

Anyone who decides to make one can just get rid of any code that they dont want to use... ie if you dont want to use temperature restrictions, you can just not call those subroutines, and not buy the 50cent probe.

I'll keep all the code as modular as I can so that its easy to get rid of bits you dont need.

I'll also try to design the electronics so if you want to you can do it all with a screw driver rather than a soldering iron, but I cant promise I'll be able to work that.

Hear me talking as I can do stuff :)

I'm yet to learn how to do this, but I'm a big fan of leap before you look, and he who hesitates is lost :)


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 20:25 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
can anyone tell me the best way to wait for an event in picaxe?

ie wait for the lever to be pressed.

should the program just loop in a very tight loop once the "do not feed" time is over like...


if pin# is high
then gosub LeverPress
else just keep checking


or should we be using the command "setint" or something?


Top
 Profile  
Reply with quote  
PostPosted: Sep 28th, '11, 21:23 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Oct 11th, '07, 19:43
Posts: 6687
Gender: Male
Are you human?: Not at 3 am :(
Location: Kalgoorlie
Is there a 'wait' command? Something that after all the timers are finished, it just waits until it receives an input from the feed lever?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 167 posts ]  Go to page 1, 2, 3, 4, 5 ... 12  Next

All times are UTC + 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group
Portal by phpBB3 Portal © phpBB Türkiye
[ Time : 0.063s | 16 Queries | GZIP : Off ]