MAS.863/4.140/6.943
How To Make (almost) Anything

Hello_world programs for t44 and nrf24L01 radios from Rob Hart, Fall 2019.

I have used an existing library for AVR and nrf24l01 to make two single-file programs: one for rx and and one for tx using the tiny44. These files use a 'bit-bang' SPI method, so that the program does not depend on there being a hardware SPI capability on the chip. I put everything needed for each program in its own file, in order to make the code consistent with other "hello-worlds". This is probably not the best practice, and makes it harder to reuse code, but perhaps makes it more readable and makes each file smaller.

Progress as of 11/13/19

How the radio transmission works:

transmission sketch

The tiny44 on the left originates a byte array (1-32 bytes can be sent in one packet.) It communicates with the nRF24L01 radio via SPI to initialize and set up the radio for transmission, then sends its byte array. The radio sends out its packet, which consists of:

The receiver sends back an acknowledgment when it has successfully received a packet.

Most of this is done automatically. All that the microcontroller program needs to do is to set up the transaction, and send and receive bytes.

See the datasheet for details. These devices are not that complicated, and the data sheet becomes somewhat comprehensible after a few minutes (hours?) gazing at it.

How I set up the radios:

tx rx

Here are the two devices that I used. The board on the left has the transmission program, which just sends out four bytes of data, with the fourth byte incremented on each transmission. The board on the right is programmed to receive, and is connected to an FTDI cable. (I used 3.3V - 5V should work, since inputs are '5V tolerant'.)

transmission sketch

Above is the output (in hexadecimal) from the receiving t44. Three bytes stay the same, the fourth is incremented.

This example does not really 'do' anything, but the possibilities are endless, once you can send bytes back and forth between two microcontrollers. In this case one radio transmits and the other receives. It would be simple to set them up to alternate between sending and receiving. You would just need to add the appropriate functions for receving to the "tx" file and vice versa.

More things to do.