Introduction: IOT123 - 5PIN ATTINY85 NRF24L01 BRICK

About: The tension between novelty and familiarity...

UPDATE: This setup is largely academic or a base for testing software/power supply. Even when the PB5 is disabled as RESET, it does not read values accurately using analogRead: the main use case for sensor readings. Will look into the ATTINY84 setup...

The IOT123 BRICKS are DIY modular units that can be mashed up with other IOT123 BRICKS, to add functionality to a node or wearable. They are based on the inch square, double-sided protoboards with interconnected through holes.

This BRICK adds 2.4GHz RF connectivity to a master for IOT node data aggregation. It is not very flexible as it only offers one pin, but it is a good starting point and more energy efficient than the 3Pin circuit that I am heading for.

This BRICK will have a BATTERY BRICK, a POWER BRICK and a BREAKOUT BRICK developed that can either be soldered or header joined.

Step 1: Materials and Tools

There is a full Bill of Material and Sourcing list.

  1. nRF24L01+ (1)
  2. 1" Double sided protoboard (1)
  3. ATTINY85-20PU (1)
  4. 8 Pin DIL IC Socket (1)
  5. Female Headers (2x4P, 1P, 2P)
  6. Hookup wire (~8)
  7. Solder and Iron (1)
  8. Strong Cyanoachrylate Adhesive (1)

Step 2: Circuit Assembly

The yellow shaded squares are positions that may be used for connections later, so try and keep them clear of wires.

If using 40P header strips, cut and file the 1P and 2P headers, also gluing the 2x4P (from 2 separate 4P's).

There are a few occasions where soldering on the other side of a through hole is obstructed. When this is the case, I soldered a dob on the target through hole, then from the side melt the solder and push the exposed hookup wire into center hole, hold and remove heat.

  1. Insert 2x4P Female Header (1), 8P DIL Socket (2, half moon to centre), 1P Female Header (3) and 2P Female Header (4) from top. Solder off on bottom.
  2. On the top, trace a yellow wire into YELLOW1 and YELLOW2, and solder.
  3. On the top, trace a yellow wire into YELLOW3 and YELLOW4, and solder.
  4. On the top, trace a yellow wire into YELLOW5 and YELLOW6, and solder.
  5. On the top, trace a red wire into RED1 and RED2, and solder.
  6. On the bottom, trace a black wire into BLACK1 and BLACK2, and solder.
  7. On the bottom, trace a red wire into RED1 and onto RED2, and solder.
  8. On the bottom, trace a yellow wire into YELLOW1 and YELLOW2, and solder.
  9. On the bottom, trace a yellow wire into YELLOW3 and YELLOW4, and solder.

Step 3: Testing

The code for testing is simple and derived from www.theengineeringprojects.com. An Arduino UNO master logs RF activity to the Serial Console. The ATTINY85 nRF24L01 BRICK increments and writes an integer to the RF channel. As we aren't using the PIN 1, I will leave the setting of the Reset Fuse Bit for a later Instructable, or you can follow the process here.

Sender Code

Receiver Code

  1. Upload the Receive code onto the Arduino UNO.
  2. Wire up the UNO to a nRF24L01 as shown above.
  3. Upload the Send code onto the ATTINY85 (ATTinyCore/ATTINY85/8MHz).
  4. Add the ATTINY85 to the BRICK.
  5. Add the nRF24L01 to the BRICK.
  6. Connect the Arduino UNO via USB to a PC.
  7. In the Arduino IDE select the correct COM Port.
  8. Open the Serial Monitor at 57600 baud.
  9. Power up the BRICK with ~3V (see 1st photo on this step).
  10. Check the values written to the console.

Code derived from https://www.theengineeringprojects.com/2015/07/interfacing-arduino-nrf24l01.html for testing on https://www.instructables.com/id/IOT123-5PIN-ATTINY85-NRF24L01-BRICK

//SEND - ATTINY85
#defineCE_PIN3
#defineCSN_PIN4
#include"RF24.h"
RF24 radio(CE_PIN, CSN_PIN);
constuint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
unsignedlong Command = 1;
voidsetup()
radio.begin();
radio.setRetries(15,15);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
radio.printDetails();
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.stopListening();
}
voidloop(void)
{
radio.stopListening();
radio.write( &Command, sizeof(unsignedlong) );
radio.startListening();
Command++;
delay(1000);
}

Code derived from https://www.theengineeringprojects.com/2015/07/interfacing-arduino-nrf24l01.html for testing on https://www.instructables.com/id/IOT123-5PIN-ATTINY85-NRF24L01-BRICK

//RECEIVE - ARDUINO UNO
#include<SPI.h>
#include"nRF24L01.h"
#include"RF24.h"
RF24 radio(9,10);
constuint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
voidsetup(void)
{
Serial.begin(57600);
radio.begin();
radio.setRetries(15,15);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
radio.printDetails();
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.startListening();
}
voidloop(void)
{
Serial.println("loop");
if ( radio.available() )
{
unsignedlong data = 0;
radio.read( &data, sizeof(unsignedlong) );
Serial.println(data);
}
delay(1000);
}

Step 4: Next Steps

Other IOT123 BRICKS that mash with this one: