4.2v LED controlled by a XMEGA

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All

 

I am using the following switch to power a PCB, The PCB will be powered using Li-Poly Battery(4.2V). 

 

10 Pcs 12V Switch, XCOZU 20A 12 Volt Switch Auto Switch 5 Color Led Rocker Switch Car Light Switches, DC Rocker Switch Round Automotive Illuminated Switch On Off Toggle Switch: Amazon.co.uk: Car & Motorbike  

 

Therefore the LED on this switch is also powered using the 4.2V. 

 

When I measure the cathode pin on the switch is measure about 1.8V. 

 

Is there a reason why this can pin can not be directly connected to a GPIO pin on an XMEGA? As seems to have a resistor inbuilt into it.

 

 

 

This topic has a solution.

Thanks

Regards

DJ

Last Edited: Sat. Mar 13, 2021 - 01:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The LED is designed to operate at 12 VDC, so it will be very dim if it lights at all at 4.2 VDC.  But you can use a GPIO as you described.

 

In consideration of others, please RTFM!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:
Is there a reason why this can pin can not be directly connected to a GPIO pin

It's a 20A switch - they are generally not great for for driving just logic loads.

 

Also, if this is for a car, beware of the usual automotive issues with spikes, surges, etc ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At 4V, seems to be still bright. I just need to use that led as a status indicator. 

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using this switch to power/off a device. Would like to use that LED as a status indicator rather than always being On.

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I measure the cathode pin on the switch is measure about 1.8V. 

Then you are measuring wrong...the led is nothing more than an led connected to the switched signal (such as 12V to be switched) through an internal resistor & to a third switch terminal (gnd)...The gnd terminal has nothing to do with the load being controlled, it is needed for the led.

 

So the led section (resistor & led) will have either 0 V applied or your load voltage (such as 12V) being controlled.

 

If you want to disconnect the led gnd to force off the led, just use an open collector NPN & base resistor to do so.   The led can light, only with the switch closed & NPN on.

You may be much better off getting a switch with 4 terminals (2 for led & 2 for switch),  depending on what you want to do.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Mar 12, 2021 - 07:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ideally, it would be best to use a 4 pin version, I will look for a compatible type.

 

When I measure the LED cathode pin, which is meant to connect to GND, it shows 1.8V, when 4.2V is connected on the other terminal. It seems internal resistance is dropping the voltage. 

 

 

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:
It seems internal resistance is dropping the voltage

It might have a constant-current driver - not just a simple resistor. Especially as you say it's still bright at just a third of its rated voltage!

 

djoshi wrote:
Would like to use that LED as a status indicator

Surely, the whole point of that switch is that the LED is directly connected to the switch terminals - so that it shows the state of the switch without any other wiring?

 

If you want to independently control the LED, you need to find a different switch where the LED is separately controlled.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:

When I measure the cathode pin on the switch is measure about 1.8V. 

 

Is there a reason why this can pin can not be directly connected to a GPIO pin on an XMEGA? As seems to have a resistor inbuilt into it.

So long as when you operate the switch, the AVR always gets power at battery voltage, then I don't see why not. NB: The LED will then be active low.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes the AVR will always be powered from the battery voltage via 3.3V power regulator.

Thanks

Regards

DJ