Announcement

Collapse
No announcement yet.

Use for the Tesla Switch

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Here's the code we're working on to use up and down buttons with the Stamp so you don't have to type in new numbers every time to change the pulse time. Attach the transistors to pins other than 14, 15. If you want to change the starting value or the amount of the Increment/Decrement, change it in the CON line. For those of you who do NOT have your chip attached to a board and have to pull it to reprogram it every time, something like this might be extremely useful because it would allow you to change values on the fly.

    ' Start pulsing two transistors with a default time
    ' Increment the time each time P4 button pressed
    ' Decrement the time each time P3 button pressed

    ' {$STAMP BS2}
    ' {PBASIC 2.5}

    DefPulse CON 5000 'Default PULSOUT time ( x 2 us. = 10000 us. = 10 ms.)
    PulseIncr CON 10 'Amount to increment/decrement ( x 20 us. = 20 us.) on
    ' each button push

    Pulse VAR Word 'Current pulse time (in units of 2 us.)

    Pulse = DefPulse
    GOSUB DisplayPulse

    DO
    PULSOUT 14, Pulse 'May need to change this and next Pin number
    PULSOUT 15, Pulse

    IF (IN3 = 1) THEN 'IN3 is the bottom of the two buttons, so, going down
    Pulse = Pulse - PulseIncr
    GOSUB DisplayPulse
    ELSEIF (IN4 = 1) THEN 'IN4 is the top of the two buttons, so, going up
    Pulse = Pulse + PulseIncr
    GOSUB DisplayPulse
    ENDIF
    LOOP

    DisplayPulse: 'Subroutine to display laest value of the PULSOUT duration
    DEBUG HOME 'Return the cursor to the top, left of screen
    DEBUG "PULSOUT Duration is ", Pulse, "( x 2 us.) "
    RETURN

    END


    David
    Last edited by Turion; 10-15-2011, 02:56 PM.
    “Advances are made by answering questions. Discoveries are made by questioning answers.”
    —Bernhard Haisch, Astrophysicist

    Comment


    • Originally posted by Turion View Post
      Here's the code we're working on to use up and down buttons with the Stamp so you don't have to type in new numbers every time to change the pulse time. Attach the transistors to pins other than 14, 15. If you want to change the starting value or the amount of the Increment/Decrement, change it in the CON line. For those of you who do NOT have your chip attached to a board and have to pull it to reprogram it every time, something like this might be extremely useful because it would allow you to change values on the fly.

      ' Start pulsing two transistors with a default time
      ' Increment the time each time P4 button pressed
      ' Decrement the time each time P3 button pressed

      ' {$STAMP BS2}
      ' {PBASIC 2.5}

      DefPulse CON 5000 'Default PULSOUT time ( x 2 us. = 10000 us. = 10 ms.)
      PulseIncr CON 10 'Amount to increment/decrement ( x 20 us. = 20 us.) on
      ' each button push

      Pulse VAR Word 'Current pulse time (in units of 2 us.)

      Pulse = DefPulse
      GOSUB DisplayPulse

      DO
      PULSOUT 14, Pulse 'May need to change this and next Pin number
      PULSOUT 15, Pulse

      IF (IN3 = 1) THEN 'IN3 is the bottom of the two buttons, so, going down
      Pulse = Pulse - PulseIncr
      GOSUB DisplayPulse
      ELSEIF (IN4 = 1) THEN 'IN4 is the top of the two buttons, so, going up
      Pulse = Pulse + PulseIncr
      GOSUB DisplayPulse
      ENDIF
      LOOP

      DisplayPulse: 'Subroutine to display laest value of the PULSOUT duration
      DEBUG HOME 'Return the cursor to the top, left of screen
      DEBUG "PULSOUT Duration is ", Pulse, "( x 2 us.) "
      RETURN

      END


      David
      Nice job David. It is nice to see you up and coming in the programming of these chips.

      Bit's

      Comment


      • Originally posted by Turion View Post
        Here's the code we're working on to use up and down buttons with the Stamp so you don't have to type in new numbers every time to change the pulse time. Attach the transistors to pins other than 14, 15. If you want to change the starting value or the amount of the Increment/Decrement, change it in the CON line. For those of you who do NOT have your chip attached to a board and have to pull it to reprogram it every time, something like this might be extremely useful because it would allow you to change values on the fly.

        ' Start pulsing two transistors with a default time
        ' Increment the time each time P4 button pressed
        ' Decrement the time each time P3 button pressed

        ' {$STAMP BS2}
        ' {PBASIC 2.5}

        DefPulse CON 5000 'Default PULSOUT time ( x 2 us. = 10000 us. = 10 ms.)
        PulseIncr CON 10 'Amount to increment/decrement ( x 20 us. = 20 us.) on
        ' each button push

        Pulse VAR Word 'Current pulse time (in units of 2 us.)

        Pulse = DefPulse
        GOSUB DisplayPulse

        DO
        PULSOUT 14, Pulse 'May need to change this and next Pin number
        PULSOUT 15, Pulse

        IF (IN3 = 1) THEN 'IN3 is the bottom of the two buttons, so, going down
        Pulse = Pulse - PulseIncr
        GOSUB DisplayPulse
        ELSEIF (IN4 = 1) THEN 'IN4 is the top of the two buttons, so, going up
        Pulse = Pulse + PulseIncr
        GOSUB DisplayPulse
        ENDIF
        LOOP

        DisplayPulse: 'Subroutine to display laest value of the PULSOUT duration
        DEBUG HOME 'Return the cursor to the top, left of screen
        DEBUG "PULSOUT Duration is ", Pulse, "( x 2 us.) "
        RETURN

        END


        David
        Nice work David.
        i am just try to learn what is basic stamp and you did all that ,I cannot follow you with this at all and I don’t have any experience with basic language so I am trying to follow but man this is bigger than me.
        Now I am putting things together for the small Tesla Switch since I have all my orders came except the #20AWG wire but I wind the transformer with wire I have in hand but my big problem is the stamp.
        I am using basic stamp activity kids and I don’t know where to hook up the 12v – and + terminals in the stamp is it in the (+) Vin and (-) Vss or what and it seems that you are using buttons so can you please help me showing where to hook up these two buttons.
        Thanks and good luck
        Ehsan
        Attached Files
        Last edited by ehsanco1062; 10-16-2011, 07:48 PM.
        Take the wisdom even from the mouths of the insane

        Comment


        • Hi David
          here is apictures for the stamp Iam using.
          Last edited by ehsanco1062; 10-16-2011, 07:48 PM.
          Take the wisdom even from the mouths of the insane

          Comment


          • ehsanco 1062

            You show the Stamp Homework Board in your picture. Lucky for you this is EXACTLY the one I am using also. And you are asking the same questions I asked when I first got it, so we all start in the same places at one time or another. Believe me, I asked and asked and asked.

            On your board you have a place to connect a 9 volt battery. You can connect the plus from battery number three to the plus side of that, and the negative from battery number three to the negative side of that to power your board, which is the easiest. (Instead of using a nine volt battery) Radio shack sells a connector for a battery that will snap onto this and has two wires. BUT REMEMBER. If you use that connector, it has a red and a black wire. THE BLACK goes to POSITIVE AND THE RED goes to NEGATIVE. It is color coded to snap onto a battery and NOT onto another connector. If you use battery number three to power your board it will now have a common ground with your setup, and all you have to do is plug your two pins into the BLACK tabs immediately to the right of "P1" and "P2." That's it. No other connections.

            You could also use a nine volt battery to power your board, but why bother. If you do, remember it has to have a common ground with battery number three anyway.

            Hope that helps.

            Bits,
            Believe me, that wasn't all me. I came up with the idea of using the buttons to change the time up and down, (there's actually a page in the workbook that comes with the kit that talks about using the buttons to do something similar, so even THAT wasn't my idea) and worked on the coding with a buddy in Florida who does this stuff for a living. I am using his brain every chance I get and he loves this stuff because it's so much more interesting than what he does when he works (as a consultant.) But I AM learning. And it's lots of fun. I took courses in Basic, but that was back when dinosaurs roamed the earth.

            What we're REALLY working on is using the four voltage readings off the four batteries to input info based on a set starting pulse time that will vary the time up and down and find where the output voltage is the highest and the discharge rate is the lowest, and then set that as the pulse time and run the program again. We're having lots of discussions back and forth about that, and what is the best chip to use and the best ADC and coprocessor and so on, possibly using a cheaper PIC chip as the coprocessor and writing the code for that. Lots of talking and exchanging of ideas on a daily basis. We'll come up with something. He wants to continue to use the Stamp because he thinks it will work for everything I want to do with it, and is easier to program than the Propeller. SO we will see.


            David
            Last edited by Turion; 10-15-2011, 11:09 PM.
            “Advances are made by answering questions. Discoveries are made by questioning answers.”
            —Bernhard Haisch, Astrophysicist

            Comment


            • Originally posted by Turion View Post
              Here's the code we're working on to use up and down buttons with the Stamp so you don't have to type in new numbers every time to change the pulse time. Attach the transistors to pins other than 14, 15. If you want to change the starting value or the amount of the Increment/Decrement, change it in the CON line. For those of you who do NOT have your chip attached to a board and have to pull it to reprogram it every time, something like this might be extremely useful because it would allow you to change values on the fly.
              Another variant is set 3-lead potentiometer (~100 kOhm) as voltage divider by one end to GND, another to Vcc and floating to on of ADC input pin, by reading ADC value in program change pulse duration. This way You can quickly modify frequency and afrer restart frequency remains as potentiometer remains in it's position.
              I still use anoloque IC as pulse generator and calibrate frequency and duty cycle by potentiometer (I use 2 in series - one 1MOhm for rough and second 5kOhm for more precisely) - it's very handy.
              Last edited by Sobakin; 10-16-2011, 02:09 AM.

              Comment


              • Yesterday I purchased four new 4A-h motorcycle lead-acid batteries, which are not gel but fluid electrolyte, already ran baseline test (4 batt in parallel) for 21W bulb - they, being fully charged before, worked 8h:15min.
                Now I recharge them.
                Last edited by Sobakin; 10-16-2011, 02:33 AM.

                Comment


                • Originally posted by Turion View Post
                  ehsanco 1062


                  We're having lots of discussions back and forth about that, and what is the best chip to use and the best ADC and coprocessor and so on, possibly using a cheaper PIC chip as the coprocessor and writing the code for that. Lots of talking and exchanging of ideas on a daily basis. We'll come up with something. He wants to continue to use the Stamp because he thinks it will work for everything I want to do with it, and is easier to program than the Propeller. SO we will see.


                  David
                  Davis you know thes How To's from Gadget Gangster ?
                  Tutorials

                  Where they have already a Tut aboud Using an ADC,
                  Look here: Using an ADC

                  And dont worry your parallax chip can easy do miltitasking..

                  Tutorial: Multitasking

                  Today my order came in so I am solder it now and can study further ...
                  I have these 3 boards:

                  http://www.gadgetgangster.com/script...bs/pic/257.jpg
                  http://www.gadgetgangster.com/script...bs/pic/175.jpg
                  http://www.gadgetgangster.com/script...bs/pic/283.jpg

                  This last one needs some modification, I want to have him under the mainboard.
                  Last edited by gandyman; 10-16-2011, 07:47 AM.

                  Comment


                  • The gadget gangster is a nice little IC. It has alot of good add ons also.

                    One thing with all IC's you have to be careful of is using your scope with them.

                    DO NOT GROUND THE SCOPE LEAD. If your IC is hooked to a computer running on AC from the wall, and if the scope is running on wall power.
                    You'll get ground loop and burn the USB ports the IC and possibly the scope depending on its type.

                    Just remember, and learn from my lesson, LOL

                    Matt

                    Comment


                    • Hi Matt

                      I have hook up the circuit and i did not want to run it until i make sure that every things is correct.
                      i have found in the schematic you draw that the diodes above the transistors have same lay out but different direction do you mean to turn the diode upside down to change the direction by the way i am using the same diodes you recommended (FFPF15UP20STTU)
                      I will not run the circuit until I will get response from you.
                      I attach some pictures so please look at it and tell me what to do.

                      Thanks
                      Ehsan
                      Attached Files
                      Take the wisdom even from the mouths of the insane

                      Comment


                      • Hi Matt
                        I also have the four Batt. 7.2 Ah charge all above 12.84v so should I hook two of them to load for discharge them to 12v and hook them as batt. No. 3 and 4 in the circuit?

                        Thanks
                        Ehsan
                        Take the wisdom even from the mouths of the insane

                        Comment


                        • Originally posted by ehsanco1062 View Post
                          Hi Matt

                          I have hook up the circuit and i did not want to run it until i make sure that every things is correct.
                          i have found in the schematic you draw that the diodes above the transistors have same lay out but different direction do you mean to turn the diode upside down to change the direction by the way i am using the same diodes you recommended (FFPF15UP20STTU)
                          I will not run the circuit until I will get response from you.
                          I attach some pictures so please look at it and tell me what to do.

                          Thanks
                          Ehsan

                          Which drawing?

                          As far the other question I am not sure I understand.

                          Matt

                          Comment


                          • Originally posted by Matthew Jones View Post
                            Which drawing?

                            As far the other question I am not sure I understand.

                            Matt
                            Hi Matt

                            This one attached
                            Attached Files
                            Take the wisdom even from the mouths of the insane

                            Comment


                            • Originally posted by ehsanco1062 View Post
                              Hi Matt

                              I have hook up the circuit and i did not want to run it until i make sure that every things is correct.
                              i have found in the schematic you draw that the diodes above the transistors have same lay out but different direction do you mean to turn the diode upside down to change the direction by the way i am using the same diodes you recommended (FFPF15UP20STTU)
                              I will not run the circuit until I will get response from you.
                              I attach some pictures so please look at it and tell me what to do.

                              Thanks
                              Ehsan

                              I see what your saying. Ya you have look at the direction and set your appropriately. Those diodes are to allow the computer to share a common ground with the transistors, while at the same time keep them Isolated.

                              Look at the diode drawing on them for the direction of the diode.
                              Same thing in the bridge rectifier if you build it.

                              Matt

                              Comment


                              • And just start out with your batteries full. No worries.

                                Matt

                                Comment

                                Working...
                                X