Automatic Toilet Flusher


Closed Thread
Results 1 to 40 of 99

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can not see very well from your pictures, but it looks like the cap is connected to the IR and can not tell where the LED is connected.

    Make sure every thing is like it is on the last page of the data sheet.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Thumbs up

    Hi Techbuilder,

    Nice job building all of that.
    The layout and diode orientation is good.
    Glad to see the little light blockers on the back side of the LEDs.
    What type of IR diodes did you use?

    It looks like the diagram on the webpage agrees with the data sheet.

    Picture 3 looks like only the electrolytic capacitor is attached to pin 1 of the device.
    Is there a hidden wire from device pin 1 to V+ or is it missing?

    Also:
    I don’t know why but, IR “Emitters” seem to have a different convention from the visible LEDs.
    The shorter lead is the Anode (+) positive polarity. Not like normal LED.

    -Adam-
    Last edited by Pic_User; - 9th February 2008 at 05:02. Reason: Added IR anode info
    Ohm it's not just a good idea... it's the LAW !

  3. #3
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Why thank you

    No there is no wire going to the positive, except that it is on the same row as pin 1
    should I connect it to positive?

    in his picture there was no wire going from the cap to positive.

    Also when I take the IR LEDS out the Green led is still on constant

    The IR LEDs are the ones that were put on the site
    they are Fairchild QED234 Infrared LEDs that I purchased from digi key.

    The only things that I used different was the radial electrolytic cap instead of the ceramic.
    But it was still rated at 0.33uf

  4. #4
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Wink "Do as I say, not as I do" old saying...

    Quote Originally Posted by Techbuilder View Post
    Why thank you

    No there is no wire going to the positive, except that it is on the same row as pin 1
    should I connect it to positive?

    in his picture there was no wire going from the cap to positive.

    Also when I take the IR LEDS out the Green led is still on constant

    The IR LEDs are the ones that were put on the site
    they are Fairchild QED234 Infrared LEDs that I purchased from digi key.

    The only things that I used different was the radial electrolytic cap instead of the ceramic.
    But it was still rated at 0.33uf
    The capacitor substitute should be fine in this application. Just be aware of the polarity.

    I agree the picture on the web page looks like there is no connection from (the junction of pin 1 and the capacitor) to 5V+.

    Here are other clues to the contrary.

    Garrett Hamilton–Smith, Raihan Khondker, and Will Norris
    "Connect the Cathode of D1 and pin 1 of the IC to same common point to be connected to +5V."
    <IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2350&stc=1&d=120257342 8">
    Ohm it's not just a good idea... it's the LAW !

  5. #5
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Cool I got it working!!!!

    Yay now I am one step further to completing the automatic toilet flusher.

    Thanks Pic_User

  6. #6
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Thumbs up Keep going....

    Quote Originally Posted by Techbuilder View Post
    Cool I got it working!!!!

    Yay now I am one step further to completing the automatic toilet flusher.

    Thanks Pic_User
    Great news Techbuilder,

    Can you give us your impressions of the results?
    Do you get the same range as the web site 15 cm (5.9”)? Reflected..
    Does the “target” surface color / shininess make a difference?
    Does ambient light clobber it?
    How much range if you detach the IR Emitters, put extension wires on them, and point them at the sensor (beam break)? Like across a door way...

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  7. #7
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Well that's a good idea so
    better yet I made a video


  8. #8
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    I got it to work!!!!!!!!!

    Although I got to adjust the ms because it only moves like 3mm but it should be done soon!


    Ps I found out what was wrong

    The servo was not connected right to the pic
    I had the postive going to the pic pin and the signal was going to positive
    I got the new servo in and now all I have todo is make some adjustments in the software

    So you will here from me soon

  9. #9
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Can't figure out the delay for the servo

    Here's my program


    IRLED1 var PORTB.0
    Servo var PORTB.1

    TRISB=%00000001
    Loop:
    If IRLED1 =1 then
    Pulsout Servo,110
    pause 10
    Pulsout Servo,150
    else
    Pulsout Servo,110
    endif
    Goto Loop

    End
    I Want it to move the servo to the right to it's most and delay for two seconds and
    then come back to center.

    If anyone can help me out
    it would be much appreciated
    Last edited by Techbuilder; - 27th February 2008 at 12:19. Reason: .

  10. #10
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Does this work?
    Code:
    x var byte
    IRLED1 var PORTB.0
    Servo var PORTB.1
    
    PORTB = 0 ' setup for high-going pulsout
    TRISB=%00000001
    
    Loop:
     If IRLED1 = 1 then
       goto Flush ' flush
     else           ' else center
      for x = 1 to 20
        pulsout Servo,150
        pause 20
      next x
     endif
      goto Loop
    
    Flush:
      for x = 1 to 20
       Pulsout Servo,200
       pause 20
      next x
      pause 2000
      Goto Loop
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  11. #11
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Thanks for the code bruce
    I appreciate it

    Although it didn't work
    instead of not moving enough like my code
    this code twitches every two seconds unless it makes contact which it just go's to center
    and the twitches are just a little more then mine was at last time
    Last edited by Techbuilder; - 28th February 2008 at 04:48.

  12. #12
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    (A long-lasting project).

    Your room mates will very soon say:
    OK, we will flush the toilet but you turn off the light at night so we can sleep!

    Seriously, what they think about your efforts?

    Best regards,

    Luciano

  13. #13
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Sorry guys I haven't put any information up
    I got ripped off by this online company

    http://www.e-clec-tech.com

    Never got the servos and they were way over priced

    but it was a lesson learned.

    I had to re order the servos but this time it is from amazon so this time I should receive my item.

    Also I have the flu and I have been in bed for a week
    it sucks but I will get better.

    As for the cap

    It is connected to pin 1 and 3 of the IR IC which is in the schematic

  14. #14
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    It is not connected
    the only thing that it is connected is to the IR receiver which it needs to be

  15. #15
    Join Date
    May 2008
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Hey everyone, I've been working on a very similar project (also my first PIC only project), before I even discovered this thread. I'm having a problem getting my servo to move 90 degrees. I'm using a parallax standard servo (left over from my Basic Stamp days), which is based on a futabu (http://www.parallax.com/dl/docs/prod...s/stdservo.pdf).

    I tried using the code that Bruce posted, but the servo only moves about 10 degrees each time the move loop is called. I also tried using a modified version of the BS2 code in the pdf I linked, but I get the same result. How can I get my servo to move the full 90 degrees?

    Here is the code I'm using:

    Code:
    @ __config _INTOSC_OSC_NOCLKOUT &_WDT_ON &_PWRTE_ON &_MCLRE_OFF &_BODEN_ON &_CP_OFF &_DATA_CP_OFF &_MCLRE_OFF
    
    
    servo1 var Porta.0
    x var byte
    
    		low servo1
    		HIGH PORTB.3
    	
    loop:	pause 500
    		low portb.3
    		pause 500
    		high portb.3
    		GOTO move
    		pause 2000
    		low portb.3
    		GOTO loop
    
    move:	for x = 200 to 1200
       		pulsout servo1,x
       		pause 18
    		next x
      		pause 2000
      		return
    I have the LED blink so I can be sure that I know the program is working properly and I can tell when the servo should be moving.

    Thanks for the help in advance!

    BTW, I'm making the project because I have a cat that is toilet trained, not because room mates don't flush
    Last edited by JohnnyV; - 20th May 2008 at 00:27.

  16. #16
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    And the PIC you are using is ______________________(fill in the blank).
    Kinda handy to have that sort of info, dontcha think?

    Servo pulse width is GENERALLY centered around 1.5ms...which means that there's probably something wrong here:
    Code:
    move:	for x = 200 to 1200

  17. #17
    Join Date
    May 2008
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    I'm using a 16F627A

    and yes, I've tried changing those numbers and I've tried using the numbers that Bruce posted, but I still get the same result regardless. I've also tried using a different servo (another parallax one)

  18. #18
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JohnnyV View Post
    I'm using a 16F627A
    and yes, I've tried changing those numbers and I've tried using the numbers that Bruce posted, but I still get the same result regardless. I've also tried using a different servo (another parallax one)
    So, you're running at 4Mhz (INTOSC). The PBP manual tells us that at 4Mhz, pulsout has a granularity of 10us. Your loop runs from 200 to 1200, meaning 2000us (2ms) to 1200 (12ms). A bit out of the range of a normal servo ya think? Unless you've got one of the oddball ones...

    Also, try turning off the WDT and Brown-Out reset for grins... You might be killing the battery voltage when the servo tries to move and causing a reset.

  19. #19
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Use GOSUB VS GOTO if the routine you're going to uses RETURN to get back.

    Disable onboard comparators with CMCON=7 before trying to use a pin that
    has the comparator feature.

    Give this a shot;
    Code:
    @ __config _INTOSC_OSC_NOCLKOUT &_WDT_ON &_PWRTE_ON &_MCLRE_OFF &_BODEN_ON &_CP_OFF &_DATA_CP_OFF &_MCLRE_OFF
    
    
    servo1 var Porta.0
    x var byte
    CMCON=7 ' <-- disable analog comparators
    
        low servo1
        HIGH PORTB.3
    	
    loop:	
        pause 500
        low portb.3
        pause 500
        high portb.3
        GOSUB move   ' <-- use GOSUB VS GOTO
        pause 2000
        low portb.3
        GOTO loop
    
    move:
        for x = 200 to 100 STEP -1 ' 2mS to 1mS pulse
          pulsout servo1,x
          pause 18
        next x
        pause 2000
      		
        for x = 100 to 200 ' 1mS to 2mS pulse
          pulsout servo1,x
          pause 18
        next x
        pause 2000
        return
      		
       END
    This should cycle your servo from one side to the other. Tested with a
    Parallax servo.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Automatic 240V / 110V selector
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 13th October 2008, 00:33
  2. LCD automatic management?
    By ruijc in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th September 2008, 11:24
  3. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  4. Automatic turn off
    By AMay in forum Schematics
    Replies: 22
    Last Post: - 6th February 2006, 12:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts