Integrating RF LED Detector with ATtiny13

Using a given microcontroller system my question was: How can I make the simplest possible RF receiver.

Similar projects worth following
I am using the ATtiny13 on the Sparrow board. LED2 is connected to port B.3 which is ADC(3) as well. So why not connect an Antenna here. The LED should work as a detector diode. A bias voltage is needed. So I should switch on the internal pullup.

Now it works fine! Don’t believe it? Watch the video. To get it sensitive enough I had to use one more trick. I switch on the pullup for a very short time. This will charge the LED which is also a little capacitor of only a few picofarads. Voltage may rise up to 2 V. Then I switch back to high Z. The LED is discharged down to about 1.5 V after some microseconds. But in the presence of an RF signal it will discharge a little lower. Several RF pulses may result in an integrated loss of LED voltage. That’s why I call it an integrating RF detector. In the end I need something like 50 mV at 100 kHz to get a clear result.

I used Basom to program the Tiny13. The source is so short I can show it here. I used an integration time of 10 ┬Ás. At the beginning I collect a reference value Ref to know the LED voltage without signal. This is used later to detect the voltage loss caused by an RF signal.

Bas and HEX files:

Cheepit upload via Sound:


The project goes on. Leander made a simple transmitter: The ATtiny13 generates an RF signal around 300 kHz and is tuned to match the LC circuit. A second LC circuit receives the RF energy. He also built a simple data link using two coils with hardly any additional components on the Tiny13.

'ATtiny13 RF receiver

$regfile = "attiny13.dat"

$crystal = 1200000

$hwstack = 8

$swstack = 4

$framesize = 4

Config Portb = &B000000010

Dim T As Byte

Dim N As Byte

Dim D As Word

Dim Ref As Word

Dim Diff As Word

Config Adc = Single , Prescaler = Auto

Config Timer0 = Pwm , Prescale = 8 , Compare B Pwm = Clear Up

D = 0

For N = 1 To 20

Portb.3 = 1

Portb.3 = 0

Waitus 10'integration time

D = D + Getadc(3)'LED2 voltage

Next N

Ref = D / 20


Portb.3 = 1

Portb.3 = 0

Waitus 10'integration time

D = Getadc(3)'LED2 voltage

If D >= Ref Then

Pwm0b = 0


Diff = Ref - D

If Diff > 2 Then

Pwm0b = 128'sound and LED1

Waitms 50

End If

End If



View project log

Enjoy this project?



b.kainka wrote 04/28/2015 at 07:38 point

The complete schematic of the Sparrow can be seen here:

Actually you need only the Tony13 plus LEDs like in the schematic above. The switches are not in use. But I added a sound transducer at B1 with 1k in series to keep Vcc quiet.

  Are you sure? yes | no

CNLohr wrote 04/27/2015 at 16:30 point

Would you mind posting a schematic?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates