touch dimmer for leds (12V)

General discussion on mikroPascal.
Post Reply
Author
Message
joseLB
Posts: 444
Joined: 02 Apr 2006 05:56
Location: Riode Janeiro, Brasil

touch dimmer for leds (12V)

#1 Post by joseLB » 12 Jul 2009 05:31

Dany wrote:Hi, here is an example of how to do it:
http://users.edpnet.be/rosseel01/DRO/PI ... C_Projects, project "TouchDimmer".
Hi Dany
For glowing leds with a pwm (12V), without usage of a triac, do you devise a simple circuit to "sense" the touch? Preferably something withou any extra component besides the pic?
Something like:
1- an open pin in pic, maybe one of the comparator pins, where the noise induced voltage at touch would be "sensed" as a change from 0 to 1?
2- or a fixed 2 near spots, one at any pic port, the other at ground, where finger resistance would drop a voltage? But, as pic needs a low impedance to drive it (15-20K maximum), I think this approach will not work.
3- Or a comparator pin open, and the other side of the 2 point spot at ground?
4- so, my ideia is something like a small 16F (or 12F) with a pwm +eletrolitic to make the Vcc to 3-4 serial leds conected to a BD139 or directly to n pic pins in parallel (soft pwm in this case), and a kind of sensor that is directly a Pic pin, like the comparator port.
4- a better and or simpler idea? That is, just a pic, some serial leds high bright, and a 7805... at worst, a bd139 or similar.
Image
thanks
Jose
--

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: tocuh dimmer for leds (12V)

#2 Post by Dany » 12 Jul 2009 15:39

joseLB wrote:
Dany wrote:Hi, here is an example of how to do it:
http://users.edpnet.be/rosseel01/DRO/PI ... C_Projects, project "TouchDimmer".
Hi Dany
For glowing leds with a pwm (12V), without usage of a triac, do you devise a simple circuit to "sense" the touch? Preferably something withou any extra component besides the pic?
Something like:
1- an open pin in pic, maybe one of the comparator pins, where the noise induced voltage at touch would be "sensed" as a change from 0 to 1?
I think this could work (I never tried it). But I think the pin should not really be left floating as such (it could have any voltage when not touched doing so). Al least it should have a high ohmic bleeding resistor should be connected to Vcc or ground (like 10Mohm).
joseLB wrote:2- or a fixed 2 near spots, one at any pic port, the other at ground, where finger resistance would drop a voltage? But, as pic needs a low impedance to drive it (15-20K maximum), I think this approach will not work.
This could work too (I never tried it myself). Here again, the "sensor" pic port should have a high ohmic (10 Mohm) resistor to the Vcc, otherwise it could have any voltage when not touched).
joseLB wrote:3- Or a comparator pin open, and the other side of the 2 point spot at ground?
I think this one has the best chance it will work. Again: a high ohmin resistor to Vcc on the sensor pin is needed.
joseLB wrote:4- so, my ideia is something like a small 16F (or 12F) with a pwm +eletrolitic to make the Vcc to 3-4 serial leds conected to a BD139 or directly to n pic pins in parallel (soft pwm in this case), and a kind of sensor that is directly a Pic pin, like the comparator port.
I have a few remarks on the electric circuit:
- The leds should be polarised the other way around.
- The base voltage of the BD139 can be maximum 5V (it comes from the PIC), while 4 leds in series need more than 5V, they will never light up.
Placing the BD139 below the leds will solve the problem.
- If you place the BD139 below the leds then it will need a base resistor (between its base and the pic pin) of approx. 1Kohm. If you use a pic pin with open drain for this (some ports are open drain, depending on the PIC) you will also need a pull up resistor (1Kohm also) between the PIC in and Vcc.
- The current in the leds is limited to (12V - (4x Vled)) / R2. I think it will be in the neighbourhood of 200 mA. Can the leds take that (especially at high duty cycle)?
- I am not sure about the PWM circuit (especially the electrolytic cap), I do not have experience with PWM yet.
joseLB wrote:5- a better and or simpler idea? That is, just a pic, some serial leds high bright, and a 7805... at worst, a bd139 or similar.
No, not better ideas, I would choose for touch opion 3, and placing the BD below the leds with addition of a base resistor.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

joseLB
Posts: 444
Joined: 02 Apr 2006 05:56
Location: Riode Janeiro, Brasil

Re: tocuh dimmer for leds (12V)

#3 Post by joseLB » 12 Jul 2009 17:46

Thanks Dany
i will try with your suggestions. I post here the results
Thanks
Jose

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#4 Post by Dany » 12 Jul 2009 19:27

Ok! :D
Dany wrote:- I am not sure about the PWM circuit (especially the electrolytic cap), I do not have experience with PWM yet.
I think the electrolytic condensator C1 should be removed. The leds do not need pure DC, they can have the PWM pulses. I think adding the cap generates undesired side effects.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

joseLB
Posts: 444
Joined: 02 Apr 2006 05:56
Location: Riode Janeiro, Brasil

#5 Post by joseLB » 13 Jul 2009 00:08

Hi,
This small snipet is detecting touches.
The circuit is just a PIC alone in EP3, pull ups off, and no matter board leds for port A are on or off.

I just put a small wire at RA1, and that is my "touch sensor". All other pins related to comparator are floating (there is nothing else than 16F628A).

When I touch wire, led in RB0 glows for a second. I didn't see it glowing when there is no touch at the wire. As I have time, I will further investigate.

Code: Select all

program dimmer_1;
 var a,k,conta: byte;
begin
   cmcon:= $05;  // comparador 2
   IntCon:= 0;   // inibe interrupcoes
   trisA:= %00001111;
   trisb:= $00;
   while 1 DO
   begin
      for k:=1 to 255 do    //loop counts number of "sensed" crossings
      begin                 //read comparator output
        a:= cmcon;
        if (a and %11000000)  <> 0 then inc(conta) //if any comparator output = 1, count a "hit"
        else portB.0:=0;
        delay_us(40);      //<=== these 2 adjusts the sensibility (increasing delay, decreases sensib.)
     end;
     if conta > 100 then   //<=== these 2 adjusts the sensibility (increasing number, decreases sensib.)
       begin
          portB.0:=1;      // if count of sensed "crossings" is suficiently high, glow b.0 led just to know it was sensed
          delay_ms(1000);
       end;
    conta:=0;
   end;
end.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#6 Post by Dany » 13 Jul 2009 10:17

Nice! :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal General”