Automatic Toilet Flusher - Page 2


Closed Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 99
  1. #41
    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 !

  2. #42
    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

  3. #43
    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 !

  4. #44
    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

  5. #45
    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 !

  6. #46
    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


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


    Did you find this post helpful? Yes | No

    Default

    COOL!
    What was the problem before?
    Dave
    Always wear safety glasses while programming.

  8. #48
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Thanks, the reason it wasn't working was because pin 3 was not going to positive so for some reason the led kept being on but once I supplied the 5 volts + to pin 3
    it worked.

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


    Did you find this post helpful? Yes | No

    Default

    Thanks, Good info.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Question pin 3 or pin 1

    Quote Originally Posted by Techbuilder View Post
    Thanks, the reason it wasn't working was because pin 3 was not going to positive so for some reason the led kept being on but once I supplied the 5 volts + to pin 3 it worked.
    Hi Techbuilder,
    Do you mean pin 3, or pin one (1) to plus (+)?
    <IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2351&stc=1&d=120266867 7">
    -Adam-
    Attached Images Attached Images  
    Ohm it's not just a good idea... it's the LAW !

  11. #51
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Yeah actually your right

    it was pin 1 that I supplied the + to because pin 3 goes to ground

    Sorry my mistake

  12. #52
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    IRLED1 var PORTB.0
    Servo var PORTB.1

    TRISB=%00000001

    Loop:
    If IRLED1 =1 then
    Pulsout 0,130
    pause 10
    pulsout 0,150
    else
    pulsout 0,150
    endif
    Goto Loop

    End
    This is the code I made do you think this might work?

    Basically I want it to read the input and if the proximity sensor is activated then have it move the servo all the way to the right or left.

    To find the center of the servo
    I knew that dead center was 1.5ms and since I am using a 4mhz crystal the time interval of PULSOUT is in units of 10 us.

    So I used this equation to find my pulse
    1.5ms = 1500us
    and then 1500/10= 150

    and clockwise is 1.3ms so I did the same equation for that

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


    Did you find this post helpful? Yes | No

    Default

    Can not comment about the servo, I do not know which one you are using.

    In your code

    Change
    Pulsout 0,130

    to

    Pulsout Servo,130

    Use either the full pin name ( PORTB.0 ) or the var assigned to it. Works much better I think.
    Dave
    Always wear safety glasses while programming.

  14. #54
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    But would it work if I corrected that?

  15. #55
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Techbuilder View Post
    But would it work if I corrected that?
    If you don't have

    include "bs1defs.bas"

    or

    include "bs2defs.bas"

    in your program, it could very well fix it.
    (Ref: Section 4.11, page 28-29 of the PBP manual)

  16. #56
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Here's the final bread board

    Maybe I am missing something I don't know
    maybe you can point it out.

    I used a 16F627A
    Attached Images Attached Images    

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


    Did you find this post helpful? Yes | No

    Thumbs up Should work...

    Quote Originally Posted by Techbuilder View Post
    Here's the final bread board

    Maybe I am missing something I don't know
    maybe you can point it out.

    I used a 16F627A
    Looks good.
    I didn’t check the PIC pin-out, expect you did that.
    Looks like a 4.7k (4k7) resistor to +, on a pin probability MCLR = good.
    Should work.
    But:
    You should have a ceramic or low inductance capacitor, right close to the PIC, between power pins. About ~ 0.1 microfarads.

    I always put an electrolytic capacitor on the +/- “rail” (power) where it comes onto the solder-less bread board. About ~ 100 microfarads.
    It would not hurt to put another electrolytic capacitor on the same power pins as the previous ceramic. About ~ 10 to 100 microfarads. Yes all the capacitors are in parallel which seems strange to beginners. You will get the idea as you start to learn about faster circuit dynamics…

    Also, I like to hang an LED with a current limit resistor on the power rail. This helps us avoid “dumb time”, when the power is off and the green trigger LED will not come on no matter how many things we try.
    Disclaimer: This is something I have heard about. I have NEVER had this happen to me.
    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  18. #58
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Thanks but it didn't work
    When I programmed the chip and put it on there nothing happened
    Was it because of my trisb?

    Or is it because of how I connected my Sharp IC to my micro controller?

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


    Did you find this post helpful? Yes | No

    Smile send more information...

    Quote Originally Posted by Techbuilder View Post
    Thanks but it didn't work
    When I programmed the chip and put it on there nothing happened
    Was it because of my trisb?

    Or is it because of how I connected my Sharp IC to my micro controller?
    Techbuilder,

    We need to see your circuit drawn as a schematic (schematic = 1000 words or 10 pictures)

    First you should try to find out if you have a hardware or software problem.

    Software = Fix code
    Hardware = Fix hardware

    Hardware:
    You need to test each portion of your circuit as a module.

    Disconnect the wire between the proximity detector and the PIC input pin.

    Run the PIC with a push button input.
    Put a 10k resistor from plus (+) to the input pin, connect a switch (or wire you can “make and break”) from the same pin to ground.
    This simulates the proximity detector.
    When you momentarily connect that input pin to ground, does your servo work?

    Yes = Problem with the proximity detector or input connection.
    No = Problem with the PIC code, PIC circuit or servo.

    To just ask without some sort out of problems puts the burden on the person not needing the help.

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

  20. #60
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Ok, Well here is the schematic.....


    There is a possibility it is the servo but I changed the software to turn on a LED when the proximity sensor is active and nothing.

    So it's either the circuit or the software
    but take a look at the schematic down bellow
    to see if I might of forgot something crucial.

    My guess is that it is the program, but it might be the interface from the sensor to the pic
    Attached Images Attached Images  

  21. #61
    Join Date
    Oct 2005
    Posts
    18


    Did you find this post helpful? Yes | No

    Default

    Maybe this can work better in case it is only code problem
    Loop:
    If IRLED1 =1 then
    for a=1 to 100 'allow several pulses for the servo to reach the requested position
    Pulsout 0,140 'could be 100=1ms to 200=2ms
    pause 10
    next a
    else
    pulsout 0,150 '150=1,5ms middle position
    pause 10
    endif
    Goto Loop



    Also check your servo if it is damaged since you power it with 9V instead of the usual 5V most RC servos work.

    Bill

  22. #62
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Thanks

    I appreciate it

    Although the servo was modified along time ago for continuous rotation,
    Although it still works

    5volts is actually low for a servo, that's the lowest amount of voltage you can imply.
    In the book I own PIC basic projects
    it has a servo page and it states that servos can run from 5vdc to 9vdc and 5volts was not recommended.

    I tested it out and it works fine

    I believe for it to be the sensor

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


    Did you find this post helpful? Yes | No

    Default

    Post the code you are currently trying.

    Write the code to make a pin high or low output. No pulses for testing and use an LED instead of the servo.

    What is the voltage at the sensor out put when connected to the PIC?
    Dave
    Always wear safety glasses while programming.

  24. #64
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Doesn't RBO and RB1 and so fourth supply 5+ to the pin?

  25. #65
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Techbuilder View Post
    Doesn't RBO and RB1 and so fourth supply 5+ to the pin?
    Yep, at roughly 25mA per pin, at MOST! Try to draw any more than that, and you'll end with a pin that won't supply squat.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Techbuilder View Post
    Doesn't RBO and RB1 and so fourth supply 5+ to the pin?
    In your case RB0 is an input so it is looking for 0 volts to 1.2 volts for a LOW and 3.6 volts to 5 for HIGH. It is best to use a pull up or pull down resistor so the pin will be 0 or 5 and not floating around. Another part or two but I like using external pulls and not rely on the internals.

    So, when the sensor is sending its high signal to the PIC and connected to the PIC, what is the voltage.

    Try making the pin high or low with out the sensor.
    Dave
    Always wear safety glasses while programming.

  27. #67
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Ok so I tried it with an led and it was working so I am guessing it is the servo
    the potentiometer must be broken in the servo

    When I get the new servo in the mail I will try it out

    thanks everyone

    by the way once everything works I will put up a "How to" for this automatic toilet flusher
    once I am done.

    Just in case anyone else wants to build it

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


    Did you find this post helpful? Yes | No

    Default

    Glad you found the problem!

    Just curios, what servo are you using?
    Dave
    Always wear safety glasses while programming.

  29. #69
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Well I still don't know if it is the servo
    because when I compiled and programed it
    the led was supposed to stay on and the other was supposed to be low
    unless it made contact, then the other led that was low now becomes high and the other led that was high before now becomes low.

    Here is the code

    LEDSW var PORTB.0
    LED1 var PORTB.1
    LED2 var PORTB.2

    TRISB=%00000001

    Loop:
    If LEDSW=1 then
    High LED1
    LOW LED2
    else
    LOW LED1
    HIGH LED2
    endif
    Goto Loop

    End

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


    Did you find this post helpful? Yes | No

    Default

    And....what happens. Does anything light up? Did you try LEDSW HIGH by running a jumper to the +5 bus?

    Might help to know the voltage output of the sensor. Possible it needs conditioned before the PIC. Even it the voltage is correct the current may not be high enough to over come the pull down resistor.
    Dave
    Always wear safety glasses while programming.

  31. #71
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    One LED stays on until the sensor makes contact
    but the other one does nothing.

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


    Did you find this post helpful? Yes | No

    Default

    One LED works as expected. The sensor and PIC work together. The code looks OK.

    Are you by chance missing an IR LED? Maybe that is the one not lighting, or on the wrong pin?
    Dave
    Always wear safety glasses while programming.

  33. #73
    Join Date
    Oct 2005
    Posts
    18


    Did you find this post helpful? Yes | No

    Default

    Perhaps Portb.1 is damaged(from 9V??? through the servo???) if only LED2 works as expected.
    Test by replacing LED1 with LED2 and vice versa in your program.
    Or try to move LED1 to another pin e.g. portb.5 just in case portb.1 is not correctly configured(depends on PIC as some pins do other things as well).
    Remember to change the TRIS register also.
    Bill
    Last edited by gebillpap; - 13th February 2008 at 15:07.

  34. #74
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Perhaps Portb.1 is damaged(from 9V??? through the servo???) if only LED2 works as expected.
    Test by replacing LED1 with LED2 and vice versa in your program.
    Or try to move LED1 to another pin e.g. portb.5 just in case portb.1 is not correctly configured(depends on PIC as some pins do other things as well).
    Remember to change the TRIS register also.
    Bill

    Portb doesn't see 9 volts if you took a look at my schematic it has a separate power supply.
    The potentiometer is what connects to the pic from the servo.

    One LED works as expected. The sensor and PIC work together. The code looks OK.

    Are you by chance missing an IR LED? Maybe that is the one not lighting, or on the wrong pin?
    No everything is there and facing right

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


    Did you find this post helpful? Yes | No

    Default

    The only thing I can say to try now is a different pin for the LED that is not working (or a different chip ) you could have a bad one.

    Sorry I can not be of more help.
    Dave
    Always wear safety glasses while programming.

  36. #76
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    No it's not your fault

    I will try with just a regular switch and then see what happens

    What resistor should I use for connecting a switch to a pin?

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


    Did you find this post helpful? Yes | No

    Default

    I use a 10K normally. Higher - more resistance- is fine if you do not have a 10K.
    The PBP manual under the BUTTON command has a schematic.
    Dave
    Always wear safety glasses while programming.

  38. #78
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Cool thanks

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


    Did you find this post helpful? Yes | No

    Default

    Techbuilder

    I saw this and thought about your project.
    https://www.gettoilettunes.com/?gcli...FREcagod0iI2bQ
    A few modifications and...well they would have to be trained to put the lid down.
    Dave
    Always wear safety glasses while programming.

  40. #80
    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

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 : 1

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