Tuesday, July 6, 2021

programming ATtiny85 w/arduino uno to send binary data via rf433

 this was 'easy' but way harder than it should have been.  

The overall process for loading the board and programming steps is well documented on the web.

The following were the 'mistakes' I was making, specifically not executing several steps and/or not in the correct order

1) Before you program the ATtiny85 board you need to upload the ArduinoISP example sketch to your Arduino Uno.  When you upload the sketch the board should be arduino uno and the programmer should be Arduino as ISP.


2) After the ArduinoISP sketch successfully loads, jumper the reset pin on the arduino.  Jumpering the uno reset pin (required for programming the ATtiny85) before executing this step resulted in failure for me.


3) Selections in the tools menu when programming the ATtiny85

- board:  ATtiny25/45/85

- Processor: ATtiny85 

- Clock: Internal 8Mhz

- Programmer "Arduino as ISP".  Do not use ArduinoISP


4) upload your desired sketch.  


Other notes

I wound up jumpering the reset pin on the arduino to the 5V on ICSP header.  Conventional wisdom on the web was to use 10 uF capacitor between reset & ground on the arduino board so proceed at your own risk


3) Pin wiring for execution of arduino code to send RF433

Power supply

-  5v to ATtiny Vcc (physical pin 8) & Transmitter Vcc

- Ground to ATtiny GND (physical pin 4) & Transmitter GND

- ATtiny PB3 (physical pin 2) to Transmitter Data pin


4) code

the following code successfully sent binary '161611' via RF433 to receiver set up on raspberry pi3 


// start with very simple sketch to send code
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
  // Transmitter is connected to Attiny Pin PB3  <--
  // That is physical pin2
  mySwitch.enableTransmit(3);
}
void loop() {
    mySwitch.send(151611, 24);
    delay(1000);
  }