Author Topic: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...  (Read 11316 times)

0 Members and 8 Guests are viewing this topic.

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #50 on: October 22, 2022, 11:17:09 am »
The PAM2821 is a switched mode LED regulator IC. It only requires four additional components, other than the LEDs and is over 90% efficient.
Looks good,  but efficiency is not a problem, since 1W-2W can be easy recharged with car alternator or bike electric motor generator during breaking  :popcorn:

Maybe, I could be more interested in step-up/step-down IC capable to provide given voltage, but I'd like to keep analog output stage while driving LEDs by using LM317 or shown simply two BC547C transistors current limit which is fine, since I can easy add 3 current sensing resistors eg. 22R 47R 47R and just by adding two more BC547C transistors in series with last two resistors 47R's and tiny MPU ( Attiny ) drive them to have nice analog LEDs output at currents around  27mA/40mA/54mA  simply by set/clear two MPU pins output without need to study PAM2821 datasheet  8)

Keep things simple  :-/O

 
---|--||||||----|||---|||-----
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19787
  • Country: gb
  • 0999
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #51 on: October 22, 2022, 12:56:08 pm »
The PAM2821 is a switched mode LED regulator IC. It only requires four additional components, other than the LEDs and is over 90% efficient.
Looks good,  but efficiency is not a problem, since 1W-2W can be easy recharged with car alternator or bike electric motor generator during breaking  :popcorn:

Maybe, I could be more interested in step-up/step-down IC capable to provide given voltage, but I'd like to keep analog output stage while driving LEDs by using LM317 or shown simply two BC547C transistors current limit which is fine, since I can easy add 3 current sensing resistors eg. 22R 47R 47R and just by adding two more BC547C transistors in series with last two resistors 47R's and tiny MPU ( Attiny ) drive them to have nice analog LEDs output at currents around  27mA/40mA/54mA  simply by set/clear two MPU pins output without need to study PAM2821 datasheet  8)

Keep things simple  :-/O
The advantage with high efficiency is it heats up less. The LEDs will probably last longer if they're not being cooked by a warm linear regulator underneath them.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6117
  • Country: de
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #52 on: October 22, 2022, 07:10:09 pm »
Why don't use the buck conerters? Will be much more efficient.
As simply as this circuit below  :popcorn:



Custom PCB allows me easy add switch to increase two times LEDs current from 25mA to around 50mA when button connects to ground second 22R  8)

I've successfully tested those LEDs by using current limiter based on 2x BC547C NPN transistors (hFE>400) and 10k main base resistor with 2x 22R current sensing resistors, where on test PCB I have connector to switch, so without second 22R resistor we have 7.94Vf@23mA, while when switch connects second R22 to ground there is around 8.21Vf@51mA  when  powered from 12.3Vbat :clap:
The second 100 ohm resistor is unnecessary. And your 8.3 V VF is unrealistic. The circuit will only start regulating correctly at around 1.8...2.0 V drop. See my earlier post with simulation.


« Last Edit: October 22, 2022, 07:13:13 pm by Benta »
 

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #53 on: October 22, 2022, 09:01:16 pm »
And your 8.3 V VF is unrealistic. The circuit will only start regulating correctly at around 1.8...2.0 V drop.
NOPE, I have real circuit with real electrons and when powered from 12.3Vbat LEDs had ~8.2Vf@50mA, so very close to shown value in my simulation  :o

Now, I've added 3rd BC547C transistor to drive second 22R from MPU (Attiny85) powered by... 3.05Vcc made of... yes.... 3V9 Zener diode  (BZX85C3V9) and ~1.5k resistors (1k+470) protected by 1N4148 diode  >:D
So far so good, MPU pin 3V drives via 10k resistor BC547C   resistor R22 to ground at voltage level ~0.13Vt, so in real circuit now when driven from MPU pins, now I have LEDs current:
0.61Vr/22R ~0.028mA
0.48Vr/22R ~0.022mA (~0.13Vt ground transistor)
so total LEDs limited current is... 50mA and this is not a simulation but real circuit shown below  :-DMM



Now it is time to write some MPU code running at 8MHz since it is powered from ~3Vcc  :-/O
« Last Edit: October 22, 2022, 09:03:41 pm by szan »
---|--||||||----|||---|||-----
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6117
  • Country: de
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #54 on: October 22, 2022, 10:02:44 pm »
And your 8.3 V VF is unrealistic. The circuit will only start regulating correctly at around 1.8...2.0 V drop.
NOPE, I have real circuit with real electrons and when powered from 12.3Vbat LEDs had ~8.2Vf@50mA, so very close to shown value in my simulation  :o
Please read again.
You show a supply voltage of 9 V.
I'm sure the circuit works at 12 V and 8.3 V LED drop. But that's not what's in your schematic, sorry. Perhaps a bit of proof-reading before posting? Just an idea.

 

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #55 on: October 22, 2022, 11:40:23 pm »
You show a supply voltage of 9 V.
I'm sure the circuit works at 12 V and 8.3 V LED drop. But that's not what's in your schematic, sorry.
No need to draw schematics for 9V/12V/14V since it works while LEDs forward voltage can be estimated with this MAXIMA formula based on real tests:

Vf(i):= 7.7 +(8.13-7.7)/(41-10)*(i-10);

Vf(10) ~7.70Vf
Vf(41) ~8.13Vf
Vf(30) ~7.98Vf
Vf(50) ~8.25Vf

I've already connected it to 9Vbat and it works, however at this point 3x 18650 Li-on batteries in series will have around 3V each, so are already discharged and it is fine and expected that this limited current will drop probably to around ~30mA, but still those LEDs are usable as daylight position lights etc. :popcorn:

(9Vbat-7.98Vf-0.7Vt)/11R ~30mA  :-DMM

I will make more experiments later when MPU software is ready, since I'd like to blink them in random pattern between lower/higher limited currents just by connecting to ground/disconnecting second 22R resistor  using MPU and pseudo random numbers generator XORed with real randomness from ADC readings, so that is why I used very unstable zener diode based ~3Vcc MPU power supply  :-/O
« Last Edit: October 22, 2022, 11:47:23 pm by szan »
---|--||||||----|||---|||-----
 

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #56 on: October 24, 2022, 03:41:58 pm »
The LEDs will probably last longer if they're not being cooked by a warm linear regulator underneath them.
Now those LEDs will for sure last longer, since its current is limited to ~25mA and ~50mA max  :popcorn:
MPU (Attiny85) 1MHz@3Vcc does the job and now  times of notmal and higher brightness are chosen randomly >:D 

https://player.vimeo.com/video/763425837

I need to add even more randomness, since I'd like to have two such front lights and avoid the situation that they blink in the same (random fashion) since for the moment simple pseudo random byte generator is used.
Idea is write the same program code to those MPUs, but XOR it from time to time with shifted bits obtained from ADC  system voltage (~3Vcc)  measurements thanks to 3V9 Zener diode avalanche noise used as power supply ~3Vcc with MPU BOD 2.7V to ensure reset in the case Vcc voltage drops too low  :-/O
« Last Edit: October 24, 2022, 03:46:07 pm by szan »
---|--||||||----|||---|||-----
 

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #57 on: October 24, 2022, 08:50:25 pm »
Regardless of whether a resistor or linear regulator is used, the power has to be dissipated as heat.
I've used linear regulator since without any capacitors we have nice smooth light strong enougth that it easy affects at night green lights powered from mains and turns them off when flash of higher current comes from those LEDs  >:D

I've increased MPU speed to 4MHz@3.2Vcc and implemented in Attiny85 MPU  true randomness source based on ADC bits from measurements of MPU Vcc by setting it as reference voltage for ADC while converting  internal 1.1Vref to ADL and something like noise byte is updated each time ADC completes conversion, than this byte is XOR'ed with pseudorandom bytes obtained from software generator, so now there is no chance that when we make a few PCBs and install there MPUs with the same code, front lights will blink in similar (pseudorandom ) pattern  :popcorn:
I could also use internal Attiny85 temperature sensor (ADC4) since those readings are device dependent and uncalibrated readings vary many *C between devices, but Vcc measurements by using MPUs internal 1.1Vrefs are good too, since  1.1V is rarely the correct value. The value is between 1.0 and 1.2. It is specific to each processor.  ::)

https://player.vimeo.com/video/763535003

« Last Edit: October 24, 2022, 08:52:29 pm by szan »
---|--||||||----|||---|||-----
 

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #58 on: October 25, 2022, 02:47:13 am »
This whole thread is about finding a new resistor value (or equivalent regulator).
The idea was not to use simple regulator equivalent to a new resistor value, but create circuit which will output adjustable unpredictable light and it looks like that idea of using avalanche diode in MPU section is not so bad to provide true randomness to LEDs driver  :phew:

Robust, low-cost, auditable random number generation for embedded system security
https://eprint.iacr.org/2016/884.pdf
"Under avalanche breakdown conditions, these diodes exhibit
random behavior called avalanche noise.
...
The resulting avalanche current is probabilistic due
to the randomness of electron collisions; the variability of
avalanche current is avalanche noise.
"

Lets add second zener diode, connect it to another MPU ADC input pin and change software to take bits from ADC conversion on this pin, while keep noisy Vcc as ADC voltage reference, so instead of reading 1.1Vref now lets read noisy ADC pin, by using noisy VCC as reference  :o
Of course, in this design we do not need strong cryptographic properties of those bits and huge bit rates, however it is interesting source of true randomness based on electrons collisions.
« Last Edit: October 25, 2022, 02:50:55 am by szan »
---|--||||||----|||---|||-----
 

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #59 on: October 25, 2022, 06:11:50 pm »
Smelling a little overthinking here.
A running car will work at a pretty much constant voltage, about 13.7-14.4V depending on the car, so a resistor will do a similar job being way more cheaper.
Resistor will not be able to detect battery voltage and turn those LEDs ON automatically when a car is running and battery voltage goes up to something around above 13.5V, while integrated MPU can do this easy, since I have more than 8MHz capable Attiny85 MPU also available in automotive version as I know :popcorn:

For the moment I'm running this Attiny85 at speed  ~4MHz@3.2V.
I've added avalanche random bits sourcing code to this MPU by connecting circuit shown below to one of its ADC inputs and added post processing of read ADC bits and now software PRNG  bytes are XOR'ed with TRNG bytes  to output unpredictable bursts of higher current pulses 8)

NOTE: This video was recorded at 30fps and thanks to linear analog LEDs regulator those quick light flashes looks nice - no PWM disturbances since it is not bloody cheap switching LEDs driver  :rant:

earth_hit_by_probikeleds_arng_pulses.mp4
https://files.fm/f/7daf99eqy


It will be fun to write some test code and output those electron based avalanche bits to computer for its randomness analysis by using NIST Test Suite Random Bit Generation RBG  https://csrc.nist.gov/projects/random-bit-generation/documentation-and-software    :bullshit:

« Last Edit: October 25, 2022, 06:21:14 pm by szan »
---|--||||||----|||---|||-----
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12297
  • Country: ch
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #60 on: October 26, 2022, 03:32:20 pm »
This whole thread is about finding a new resistor value (or equivalent regulator).
The idea was not to use simple regulator equivalent to a new resistor value, but create circuit which will output adjustable unpredictable light and it looks like that idea of using avalanche diode in MPU section is not so bad to provide true randomness to LEDs driver  :phew:
Which you didn’t mention until long into the thread. And you never did the basic investigation of seeing how much current the LED bulb actually drew with its original resistor.
 

Offline szanTopic starter

  • Regular Contributor
  • *
  • Posts: 84
  • Country: bs
Re: Hacking cars LEDs 12V 47R internal resistor to 100mA max current limit ...
« Reply #61 on: October 26, 2022, 08:57:33 pm »
And you never did the basic investigation of seeing how much current the LED bulb actually drew with its original resistor.
When I smell  :bullshit: I follow the rule - DO NOT turn on ... take it apart  :-DD
Customized LEDs with maxium 50mA current limit performs as expected  8)
---|--||||||----|||---|||-----
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf