1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Junebug help??

Discussion in 'Microcontrollers' started by MrDEB, Apr 8, 2009.

  1. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    Have you seen this you have it on your computer it swordfish help
     

    Attached Files:

    • help.PNG
      help.PNG
      File size:
      80.9 KB
      Views:
      119
  2. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    And perhaps MrDEB may add a diode or RC across the speaker coil to protect the transistor.
     
  3. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    He don't need one. It's a speaker not a motor. Use a diode on a motor or relay not a speaker.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22

    I guess mvs sarma dosn't know about deer

    Deer and other critters are attracted to diodes and RC circuits!!
    you will have deer from miles around comming to munch on your garden w/ diodes and RC circuits --LOL
    oh I come up with a new name for this device = CRITTER RIDDER
     
  6. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    You may be correct if the driving transistor is working in linear mode and handling a sine wave. but an unbiased transistor driving a square wave into a speaker at its collector, I feel, definitely produces back emf and should be protected. I saw many such schematics where such protection is provided. Shortly, i shall be able to provide links to confirm my thought.
     
  7. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    You can if you want to mvs sarma people have argued this for years but a speaker use the
    its not going to hurt his little npn because it never going to send back more then his little npn can handle.Now if it was a 12volt motor then for sure put a diode on it.
    1.It lowered the output of the speaker with it and the sound wasn't right. Diode in there
    2.With out the sound was good it never hurt the npn. No diode on it.
     
    Last edited: Apr 13, 2009
  8. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    looking at using the pwm code

    you posted be80be.
    but using something less elaborate than a RNG.
    going to connect the 10k/npn to breadboard etc then run your code
    have to come up with a way to change the DUTY variable you put in.
    any suggestions??
    only need to go from 2khz to 6khz randomally so a RNG prg that uses 5 numbers or maybe a few more.
    THEN I need to trigger the pic with a PIR sensor.
     
  9. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    What PIR are you using. I been playing with it but I can make better sound not using the PWM and using this
    Code (text):

    Device = 18F1320
    Clock = 8 // tells the compiler the FOSC speed
    Config OSC = INTIO2, WDT = OFF, LVP = OFF
    Include "Utils.bas"
    Dim out As PORTB.3
    OSCCON = %01111111
    SetAllDigital

     Low (PORTB.3)
     While true
     
        High (out)
        DelayUS (1400)   // justs change this to change sound
        Low (out)
        DelayUS (700)  // and this to
       
       
     Wend
     
    then set a timer and run the code with more delay
    works better then the PWM
     
  10. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
  11. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    You can change it how ever you want that just shows you how easy it is to get sound. thats about 11khz if my math is right. There are PIR that work like a switch easy to use with a pic almost a no brainer. That pir is easy to use. Not very good but easy to set up the range is to short.
     
    Last edited: Apr 13, 2009
  12. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    they were cheap

    I purchased 5 units to test out the CRITTER RIDDER
    just need the PIC set up as I started designing a PC board
     
  13. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    have to ask=

    caculated for 11khz?
    what caculations are these based on.
    I looked at the utilis.bas file ????
    what caculs are needed??
     
  14. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    I divided the clock by the delayUs which is about 11khz tone
    The Utils.bas gives you command to use so you don't have to code it your self.


     
  15. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    delay is 1400

    1400 divided by 8000 = .175
    are you sure its not multiply??
    1400x8000 = 112000
    700 x 8000 = 5600
    am I missing something??
     
  16. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    TimeMe in swordfish

    is this several different timers or all as one.
    not sure of what I need
    1 = when PIR detects motion it sets the sound prg to run
    2 = sound program to change frequencies from 2000 - 6000 hz back and forth
    3 = after say 5 - 10 seconds the pic shuts off waiting for another occurrence.
    be80be has posted several sound codes=THANKS
    now I need to figure out how to increment and decrement the sound code value
    I was thinking just a loop that adds say 100 to one variable then substracts 100 from second variable

    TimerA()=0

    A=700, B=1400 //A and B determine sound frequency see be80be post above
    A + 100, B - 100
    until A >= 1400
    A= 700, B= 1400
    if TimerA()=100 then wend

    I have a hunch this is close (I remember programming the VIC 20, C64 and the C128)
    yes I is an old fart
     
  17. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    I had all three and a lot more What's hard is swordfish is not the same as the basic you used then so I have to do a lot of reading
    and I just started back coding haven't done any in over 25 years till about year and a half ago i used a stamp it's easy to code but cost to much. been picking about 8 months still learning lol
     
  18. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    reading your posts you appear

    to be an expert programmer?
    I myself am just starting out with this PIC stuff.
     
  19. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    I didn't say I can't The point was It's been a long time and just started back. Got to do a
    lot of reading to get up to speed. Swordfish has a module for the timer. You can set like
    3 events 1 if pir gos off then do low sound then high sound it's here. Swordfish Wiki | SwordfishUser / Timer0 browse
     
  20. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    I browsed that module

    looks like greek but will try and understand it.
    found a website that describes how to creat a sine wave using a PIC
    My PIC Projects
    almost at the bottom
    ?????????
     
  21. pkshima

    pkshima Member

    Joined:
    Jan 23, 2003
    Messages:
    343
    Likes:
    1
    Location:
    New Delhi, India
    Try pressing the PICs on the Junebug hard. LEDs were not blinking sometimes in my case. It sure was a problem of loose PICs.

    Ow my bad. just disregard the post :)
     
    Last edited: Apr 14, 2009

Share This Page