Uv led as Uv Sensor

Short video made during the 2015 eTextile Summercamp:
How you can use a Uv led as a Uv sensor

During the eTextile Summercamp we experimented on the topic of Educational toolkits.
The thread some people started to work on was called “Go cheaper, delve deeper”, or on how you can make low cost sensors with really basic materials. By using only simple components, you have to go to the base level understanding and use of the electronic(s) part(s).

In this pocket size project we looked deeper into the led, the light emitting diode. An Led can also be used as a photodiode, sensing light instead of emitting – this website explains in detail how this process works.
A Uv led emits Uv light – other leds have been produced to filter out this light frequency. We wanted to measure the Uv in sun light – so, for the reverse process – you need the Uv led (as the other ones are blocking this type of light to be emitted, the same goes on the receiving end).
Mika Satomi had some in her collection:

uv led

When put in the sunlight, the led charges itself with the energy from the sun, but it also discharges itself (like a capacitor would behave).

In order to stabilize this pulsating effect, you add a big resistor in parallel with the led. With this type of Led, 3 MegaOhm was the best value and the most stable – other leds will require other resistors.

After some experimenting, we had ourselves a circuit – and a mini project, where the Uv light is converted into sound & light. The more Uv in the sunlight, the brighter the led shines, and the tones in the piezo change.

– AtTiny
– UvLed
– 3 MegaOhm resistor – this depends on your UvLed – test it out! it could be more or less megaOhm
– red led
– 100 Ohm resistor
– piezo
– power supply
– code
– sunshine


Circuit sewn by Anja hertenberger
Code by Jussi Mikkonen & Arduino

This is the very basic code we put on the AtTiny: Uv_Tiny
For debugging it is nice to be able to port this circuit to the Arduino, where you can use the serial monitor to sniff out the values: Uv_Duino

Afterwards I tried the same circuit on a breadboard with through hole Leds – this type of led only needed a 1 MegaOhm resistor.



When creating your sketches, note that the pin number allocations are different for ATtinys in the IDE than for a “regular” Arduino Uno. Note the following pin number allocations:

  • digital pin zero is physical pin five (also PWM)
  • digital pin one is physical pin six (also PWM)
  • analogue input two is physical pin seven
  • analogue input three is physical pin two
  • analogue input four is physical pin three

One response to “Uv led as Uv Sensor

  1. Pingback: UV LED as UV Sensor |·

Leave a Reply

Your email address will not be published. Required fields are marked *