Shop OBEX P1 Docs P2 Docs Learn Events
Bird photography studio & bird feeder — Parallax Forums

Bird photography studio & bird feeder

RagtopRagtop Posts: 406
edited 2015-05-05 06:12 in Robotics
Haven't done a electronic project in over a year and was afraid I had forgotten the little bit
I had learned about circuits and working with Spin.

It mostly came back to me and it helped that the first project back in is a "Frankenstein" of
past projects.


I thought I would post pictures and take guesses on what it does.

If the guesses are better then what it actually does, I will go back and change what it does.
1024 x 683 - 651K
910 x 1024 - 831K

Comments

  • RagtopRagtop Posts: 406
    edited 2015-03-01 05:47
    No guesses?

    Well, the next picture of the remote unit in it's location pretty much gives it's function away.

    The remote unit uses two ping sensors to determine if something has landed on perch or bowl. (distance < 300mm)
    It takes a picture and sends which sensor was hit and distance from both sensors back to the base station.

    The remote unit is also listening on the xbee to see if any buttons have been pressed on the base station
    If the visitor has fur instead of feathers, I can play one of three tunes on the car alarm next to the bird feeder.
    If I want to take more pictures, I can control the camera with a button on the base station.

    The base station blinks a light and sounds a buzzer when either of the ping sensors are hit. It also records the hits
    to a file on the SD card.

    So far, everything is working except for visitors.

    Next up is adding a video camera to the mix.

    attachment.php?attachmentid=113332&d=1425217109
    IMG_1444.jpg
    1024 x 641 - 527K
  • MoskogMoskog Posts: 554
    edited 2015-03-01 06:30
    Who will check if the visitors have fur or feather, you or the Propeller? Or is it simply that's why you have a camera there with kind of application that scans the picture?
    Awesome project anyway, it remainds me I should have gone further with a project that scans my garden for incoming deers. They usually do unacceptable damage to my fruit trees.

    I wonder what's in the background out of focus, lots of furs from skinned foxes? (img_1444.fpg)
  • RagtopRagtop Posts: 406
    edited 2015-03-01 06:40
    This is from a test of writing the data to the log file on the base station's sd card.
    It creates a comma delimited file telling 1) which sensor 2) time 3) total minutes
    4) distance from perch sensor 5) distance from bowl sensor

    It also records when I press a button on the base station.

    The total minutes field proved unnecessary. I was having trouble with
    Excel charting using time for x and distance for y. It didn't seem to be spacing
    out the time interval, but I was using the wrong chart. Line chart spaces each
    data point equally along x axis, but XY chart accounts for gaps in time.


    Bowl,08:56 am,536,819,182
    Perch,08:56 am,536,294,292
    Bowl,08:57 am,537,294,292
    Perch,08:57 am,537,262,747
    Bowl,08:58 am,538,796,125
    Bowl,08:58 am,538,770,129
    Bowl,08:59 am,539,762,76
    Bowl,09:00 am,540,671,82
    Perch,09:01 am,541,292,501
    Bowl,09:01 am,541,791,75
    Picture,09:04 am,544,0
    Bowl,09:06 am,546,847,270
    Perch,09:06 am,546,157,175
    Zapped,09:06 am,546,0
    Bowl,09:07 am,547,157,175
    Bowl,09:07 am,547,774,103
    Bowl,09:08 am,548,3331,94
    Bowl,09:08 am,548,3318,125
    Perch,09:13 am,553,119,556
    Bowl,09:19 am,559,828,278
    Picture,09:21 am,561,0
    Bowl was triggered 13 times
    Perch was triggered 5 times
  • RagtopRagtop Posts: 406
    edited 2015-03-01 06:45
    Not a MIT grad, so it requires visual (human) identification as the feeder is outside my window.

    In the background are banana plants that hopefully are not completely dead with the few days of below freezing we got.
  • RagtopRagtop Posts: 406
    edited 2015-03-02 07:40
    Base Station Code
    CON              
     _clkmode        = xtal1 + pll16x
     _xinfreq        = 5_000_000
    
    blue = 8          'buttons
    yellow = 9
    white = 10
    green = 11
    rled = 0          'Tri-color LED
    bled = 1
    gled = 2
    
    alarm = 7        'Buzzer
    
    filebutton = 27  'Extra button added to breadboard to close the log file at end of day
    
      _dopin = 23     'SD card writer
      _clkpin = 22
      _dipin = 21
      _cspin = 20
      _cdpin = -1 ' -1 if unused.
      _wppin = -1 ' -1 if unused.
    
      _rtcres1 = -1 ' -1 always.
      _rtcres2 = -1 ' -1 always.  
      _rtcres3 = -1 ' -1 always.
    
      { XBEE 4 and 5 in program below}
      {GPS receive 16 and transmit 24 in gps float lite}
    
    Obj
       Xbee   : "XBee_Object_2"
       Freq   : "Synth"
       sdcard : "SD-MMC_FATEngine.spin" 
       GPS    : "GPS_Float_lite"
       FS     : "FloatString"   
           
    Var
     long DataIn,x,y,hour,leftrange,rightrange, minute, m, totalminutes 'to store data received from xbee
     long ButtonStack[48] 'Button presses are checked in another cog
     long Frequency       'For the buzzer
    Pub Main
        x:=0   'total counts for bowl and perch visits
        y:=0
       dira[rled]~~
       dira[bled]~~
       outa[rled] := 0
       outa[bled] := 0
       cognew (Checkbuttons,@ButtonStack)
       waitcnt(clkfreq  + cnt) 
       sdcard.fatEngineStart( _dopin, _clkpin, _dipin, _cspin, _wppin, _cdpin, {
                        } _rtcres1, _rtcres2, _rtcres3)
       sdcard.mountPartition(0)  
       waitcnt(clkfreq  + cnt)
       sdcard.newFile(string("birdlog.txt")) 
       sdcard.openFile(string("birdlog.txt"), "W") 
       GPS.Init       'GPS is used to get time
       waitcnt(clkfreq * 2 + cnt)
       xbee.start(4, 5, 0, 115200)   
    
       waitcnt(clkfreq * 2 + cnt)
       outa[rled] := 1          'To alert me everything has loaded.  Had problems with SD card not mounting at first.
       waitcnt(clkfreq  + cnt) 
       outa[rled] := 0  
       repeat         
          CheckRemote
          waitcnt(clkfreq / 2 + cnt) 
    
    
    Pub CheckRemote
          DataIn := Xbee.Rx 
          if DataIn == "L"              'to confuse me more I reference the two sensors as left and right and perch and bowl
              outa[rled] := 1
              leftrange := Xbee.Rxdec
              rightrange := Xbee.Rxdec 
              x++
              WritePerch
              sound
              waitcnt(clkfreq * 5 + cnt)
              outa[rled]:=0
          if DataIn == "R"
              outa[bled] := 1
              leftrange := Xbee.Rxdec 
              rightrange := Xbee.Rxdec 
              y++
              WriteBowl
              sound
              waitcnt(clkfreq * 5 + cnt)
              outa[bled]:=0          
    Pub Checkbuttons
        dira[gled]~~
        outa[gled] := 0
        dira[blue]~        'inputs
        dira[yellow]~
        dira[white]~
        dira[green]~
        dira[filebutton]~ 
        repeat
          if ina[filebutton] == 1      'closes the log file
             Closefile
             repeat 6
              !outa[gled]
              waitcnt(clkfreq / 9 + cnt)
          if ina[blue] == 1             'blue button takes a picture with the camera
              WritePicture
              xbee.str(string("C"))
              outa[gled] := 1   
              waitcnt(clkfreq + cnt)
              outa[gled] := 0
          if ina[yellow] == 1          'yellow plays one of the three tunes of the car alarm
              WriteShoo 
              xbee.str(string("B"))
              outa[gled] := 1   
              waitcnt(clkfreq + cnt)
              outa[gled] := 0
          if ina[white] == 1          'white plays the best of the three tunes of the car alarm     
              WriteShoo
              xbee.str(string("A"))
              outa[gled] := 1   
              waitcnt(clkfreq + cnt)
              outa[gled] := 0
          if ina[green] == 1          'green plays one of the three tunes of the car alarm     
              WriteShoo
              xbee.str(string("D"))
              outa[gled] := 1   
              waitcnt(clkfreq + cnt)
              outa[gled] := 0
    Pub WritePerch
        sdcard.writeString(string("Perch"))
        TimeStamp
        printDecimal(leftrange)
        sdcard.writeString(string(","))    
        printDecimal(rightrange)
        sdcard.writeString(string(13,10))
    Pub WriteBowl
        sdcard.writeString(string("Bowl"))
        TimeStamp
        printDecimal(leftrange)
        sdcard.writeString(string(","))
        printDecimal(rightrange)
        sdcard.writeString(string(13,10))       
    Pub WriteShoo
        sdcard.writeString(string("Zapped"))
        TimeStamp
        sdcard.writeString(string("0"))
        sdcard.writeString(string(13,10))    
    Pub WritePicture
        sdcard.writeString(string("Picture"))
        TimeStamp
        sdcard.writeString(string("0"))
        sdcard.writeString(string(13,10))        
    Pub CloseFile
        sdcard.writeString(string("Bowl was triggered ")) 
        printDecimal(y)
        sdcard.writeString(string(" times",13,10))
        sdcard.writeString(string("Perch was triggered ")) 
        printDecimal(x)
        sdcard.writeString(string(" times",13,10))    
        sdcard.unmountPartition 
    PUB sound
     repeat 2
       'repeat 1
         Frequency := 1000
         repeat until Frequency == 1500                                             'loop forever to keep cog alive
             Frequency:=Frequency + 1
             Freq.Synth("A",Alarm, Frequency)
      repeat 150
         Frequency := 1500
         repeat until Frequency == 2000                                             'loop forever to keep cog alive
             Frequency:=Frequency + 100
             Freq.Synth("A",Alarm, Frequency) 
    
             
     Frequency := 0
     Freq.Synth("A",Alarm, Frequency)
    
    Pub TimeStamp
         m := 0      'am or pm                      'converts to eastern and 12 hour time
         totalminutes := 0
         sdcard.writeString(string(","))
         hour := gps.Long_Hour - 5
         minute:=gps.long_minute
         totalminutes := (hour * 60) + minute   
         if hour < 10
            m := 0 
            sdcard.writeString(string("0"))
            printDecimal(hour)
         else
            if hour > 12
               hour := hour - 12
               m := 1
            else
               m := 0   
            printDecimal(hour)
            
         sdcard.writeString(string(":"))
            
         if minute < 10
            sdcard.writeString(string("0"))
            printDecimal(minute)
         else
            printDecimal(minute)
            
         sdcard.writeString(string(" "))
    
         if m == 0
            sdcard.writeString(string("am,"))
         else
            sdcard.writeString(string("pm,"))   
    
         printDecimal(totalminutes)
         sdcard.writeString(string(",")) 
     
    PRI printDecimal(integer) | temp[3] ' Writes a decimal string.
    
      if(integer < 0) ' Print sign.
        sdcard.writeByte("-")
    
      byte[@temp][10] := 0
      repeat result from 9 to 0 ' Convert number.
        byte[@temp][result] := ((||(integer // 10)) + "0")
        integer /= 10
    
      result := @temp ' Skip past leading zeros.
      repeat while((byte[result] == "0") and (byte[result + 1]))
        result += 1
    
      sdcard.writeString(result~) ' Print number.      
    
  • RagtopRagtop Posts: 406
    edited 2015-03-02 07:58
    Remote Code
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
      leftEchoPin = 14       'Ping sensors are 4-pin EBAY cheapos.            
      leftTriggerPin = 15
      rightEchoPin = 16                  
      rightTriggerPin = 17 
    
      Alarm  = 0             '12v car alarm interfaced with a transister
      Camera = 1             'remote port of canon camera.  uses optocouplers to interface
    
    VAR
       long  leftrange, leftrangeOld,rightrange,rightrangeold 'for ping sensors
       long ButtonStack[48]                                   'checks for base station button presses in separate cog
       long DataIn                                            'xbee receive
       long Frequency                                         'for alarm
    OBJ
      Ultra  : "UltrasoundSR04_120612a"    'ping sensors
      Xbee   : "XBee_Object_2"
      Freq   : "Synth"                     'for car alarm
    PUB Start
         dira[camera]~~  'output
         outa[camera] := 0
    
      xbee.start(21, 22, 0, 115200)
      waitcnt(clkfreq * 4 + cnt)
      cognew (Checkbuttons,@ButtonStack)
      
      leftrange := -1  ' set to impossible range to make sure first new range is displayed
      rightrange := -1
      repeat
        leftrange := Ultra.Millimeters(leftEchoPin, leftTriggerPin)                 ' Get Range In Millimeters
        rightrange := Ultra.Millimeters(rightEchoPin, rightTriggerPin)                 ' Get Range In Millimeters
    
        if leftrange < 300               'if range is less then 300mm something has entered the feeder
             waitcnt(clkfreq * 2 + cnt)  'give creature 2 seconds to settle before clicking picture
             TakePicture
             xbee.str(string("L"))       'alert base station of the intrusion
             xbee.dec(leftrange)
             xbee.str(string(13))
             xbee.dec(rightrange)
             xbee.str(string(13))
             waitcnt(clkfreq * 20 + cnt)  'wait 20 seconds before checking again to reduce the number of pictures of same bird                                
            
        if rightrange < 300
             waitcnt(clkfreq * 2 + cnt) 
             TakePicture
             xbee.str(string("R"))
             xbee.dec(leftrange)
             xbee.str(string(13))         
             xbee.dec(rightrange)
             xbee.str(string(13))
             waitcnt(clkfreq * 20 + cnt)                 
    
        waitcnt(clkfreq / 10 + cnt)                         ' Pause 1/10 Second
        
    Pub TakePicture
        outa[camera] := 1
        waitcnt(clkfreq / 3 + cnt)
        outa[camera] := 0 
    Pub Checkbuttons
       dira[camera]~~  'output 
       repeat
         DataIn := Xbee.Rx
         If DataIn == "A"
            SoundThird
         If DataIn == "B"
            SoundSecond
         If DataIn == "C"
            TakePicture
         If DataIn == "D" 
            SoundForth 
    
    PUB SoundFirst
    
     repeat 10
      Frequency := 2000
      repeat until Frequency == 50000                                             
             Frequency:=Frequency + 1000
             Freq.Synth("A",Alarm, Frequency)
     Frequency := 0
     Freq.Synth("A",Alarm, Frequency)
    PUB SoundSecond
    
     repeat 2
      Frequency := 1000
      repeat until Frequency == 6000                                             
             Frequency:=Frequency + 10
             Freq.Synth("A",Alarm, Frequency)
     Frequency := 0
     Freq.Synth("A",Alarm, Frequency)
    PUB SoundThird
     repeat 2
       'repeat 1
         Frequency := 1000
         repeat until Frequency == 1500                                             
             Frequency:=Frequency + 1
             Freq.Synth("A",Alarm, Frequency)
      repeat 150
         Frequency := 1500
         repeat until Frequency == 2000                                             
             Frequency:=Frequency + 100
             Freq.Synth("A",Alarm, Frequency) 
    
             
     Frequency := 0
     Freq.Synth("A",Alarm, Frequency)         
    PUB SoundForth
    
     repeat 100
      Frequency := 1500
      repeat until Frequency == 2000                                             
             Frequency:=Frequency + 100
             Freq.Synth("A",Alarm, Frequency) 
     Frequency := 0
     Freq.Synth("A",Alarm, Frequency) 
    
  • RagtopRagtop Posts: 406
    edited 2015-03-06 18:19
    First Visitor.

    attachment.php?attachmentid=113413&d=1425694735
    1024 x 683 - 478K
  • RagtopRagtop Posts: 406
    edited 2015-03-08 07:14
    Was afraid the birds might be able to hear and be annoyed by the ultrasonic frequency, but visitors are starting to come in.
  • RagtopRagtop Posts: 406
    edited 2015-03-28 15:03
    Finally got a squirrel test subject for the Car Alarm deterrent which turned out not to be a deterrent at all.
  • garyggaryg Posts: 420
    edited 2015-03-28 16:54
    Squirrel and Deer are the most difficult animals to scare off.
    It might pay to add some type of motion like a servo operated gloved hand.
    The motion helps with deer.
    Also, deer do not like George Thorogood music.
    Not sure about squirrel's.
    ..
    The birds do not seem to be affected by the deturrents I've built.
  • RagtopRagtop Posts: 406
    edited 2015-04-21 13:38
    Finally got around to adding the contour video camera to the rig.
  • RagtopRagtop Posts: 406
    edited 2015-05-03 13:08
    Some more pictures from the rig. I moved the camera off to a tripod as I believe I had the camera
    too close on the rig both for focusing and scaring the birds when the shutter went off.

    attachment.php?attachmentid=114047&d=1430683578
    attachment.php?attachmentid=114048&d=1430683597
    attachment.php?attachmentid=114049&d=1430683630
    attachment.php?attachmentid=114050&d=1430683642
    attachment.php?attachmentid=114051&d=1430683652
    attachment.php?attachmentid=114052&d=1430683663
    1024 x 1063 - 750K
    1024 x 721 - 598K
    1024 x 1110 - 638K
    1024 x 695 - 491K
    1024 x 1167 - 982K
    1024 x 821 - 550K
  • kwinnkwinn Posts: 8,697
    edited 2015-05-03 19:31
    Congrats. Great project and some beautiful pictures. I'm tempted to do something similar when I have the time.
  • xanaduxanadu Posts: 3,347
    edited 2015-05-03 20:14
    Great shots! That worked really well.
  • RagtopRagtop Posts: 406
    edited 2015-05-04 05:32
    I really like having the camera back on the tripod, as it allows me to try different angles each day.

    I am down to one ping sensor as I forgot to add a flyback diode to a motor I was adding to scare away squirrels.
    Luckily the ping sensor bite the bullet instead of the xbee.

    I still haven't added a new squirrel deterrent.
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-05-04 07:37
    These are turning out really good. The squirrel (although an unwanted visitor) turned out great!!

    I'm not sure if you are using an exposure setting of auto, programmed, shutter priority or aperture priority. Photographically, I'd suggest you exchange some shutter speed and ISO (film speed :D ) for a smaller aperture (bigger F number) and more depth of field. Since you have lots of Florida sunshine to work with, I'd start out with Aperture Priority and try something in an F8 or F11 and see what kind of shutter speeds you get. It looks like you are using an older Canon , the ISO should probably stay at 400 or less.

    Greater depth of field will make it easier to have the front end and the back end of your bird in focus. You can see now i man of the pictures where you depth of field is a matter of inches. Higher ISO numbers will make the image noisier (grainier), slower shutter speeds will introduce blur from the birds motion (they twitch quickly), faster shutter speeds let you freeze action better. These are all things you can play with depending on the light for the day and the subject.

    I don't know if you are pre-focusing or auto-focusing for these shots. If you are using auto-focus, you may want to try manual focus and focus on the mount midpoint or maybe the mount midpoint minus 1/2 a birds length :) to give you a good head shot when they are facing you. Not having the camera auto-focus will make it respond faster and also give you a consistent focus zone as you watch from you perch.

    It's a great project and should prove to be lots of fun as your visitors get used to everything!
  • RagtopRagtop Posts: 406
    edited 2015-05-05 06:12
    I have tried manual mode to get a bigger focal plane, but I would have to adjust it throughout the day and a
    odd cloud at the wrong time would mess up a picture. It has aperture mode but even on my Rebel T3i, these
    "assist modes" are horrible at getting white balance for some reason.

    Once I get a time of day that gets the most traffic (right now traffic is fairly random) I will probably try manual
    mode again.

    Not using auto-focus. The lens rotating even freaks them out. Kinda wish I had a good mirror-less camera so it would
    be noise free.
  • I love it.

    Have been busy with my own project for a couple of years and have not been checking what others have been doing. I now know what my next project will be. Methinks a mini gas cannon using a butane canister and pizeo igniter would do wonders keeping unwanted critters away. With all that expensive equipment near my feeders I will have to give up using my air rifle BB gun.
  • ercoerco Posts: 20,254
    There are "other" options to deter squirrels.

  • erco wrote: »
    There are "other" options to deter squirrels.

    You video reminds me of my favorite part of the movie Up.



    Where's Ragtop these days? He sure made a lot of cool projects. I hope all is well with him.

  • Ragtop, do you still have the bird studio up and running? Did you try to put your camera in Av mode? Means you can lock the iris in a high F-value and the camera will adjust the shutter speed due to different light conditions. Cameras usually have a auto-white balance too that can help. The ISO value should be as high as possible too to get the shutter speed fast but probably not more the 400 as mentioned above. You will have to find out this by testing.
  • WhitWhit Posts: 4,191
    Glad this thread resurfaced - enjoyed looking again!
  • A few notes from my experiences scaring squirrels away from the blueberries in our backyard...

    Squirrels are prey animals and have a strong startle reflex. So what really makes them run away is sudden movement and noise. The car alarm test video above only has noise, which is why the squirrel sits there and thinks about if he should leave or not.

    You want to have sudden unexpected movement, and the squirrel will soon learn that the thing that moves when he gets close is to be avoided. Get a small DC motor with some sort of wheel that spins, with a pinwheel or something with flaps on it. Make sure it starts up fast! A typical servo is probably too slow.

    I've used an RC car sitting out by the bird feeder, which I can see out the window of my home office. It sits there, and then when a squirrel comes up, I pick up the controller and have the car charge the squirrel. The squirrel will RUN. And they quickly learn to recognize the thing that is "guarding its territory" and if they see it, they won't even come close.

    However, it seems that the local hawks and other predators cause a lot of turnover in the squirrel population, so there is frequently a new one that has to learn what to stay away from.

    We've also used a Scarecrow animal deterrent, which is basically a sprinkler with a motion sensor on it. It works ok for deer, but they eventually learned to stand just outside of its range and calmly munch the apples off the tree while it lightly sprays them. The squirrels NEVER got used to it and would freak out every time it would go off.
    https://www.contech-inc.com/products/animal-repellents/scarecrow-motion-activated-animal-deterrent
Sign In or Register to comment.