Introduction: NRF24L01 on STM32F103

About: Works with Arduino, RaspberryPi, Banana Pi, Orange Pi, STM32F103C, ESP8266,

This instructable is for those that want to get started using the "Blue Pill" with the NRF24L01.

OK, I'm cheap! I used the tutorials for the NRF24L01 to link two arduinos together, but then... Along came the "Blue Pill." The "Blue Pill," or STM32F103C, is a super cheap ARM cortex board, only slightly larger than a NANO, will a multitude of IOs, that can be bought at a fraction of the cost of an Arduino Uno. If you look online, sometimes they can be under $2.00.

I'm an advocate of cheap and easy. I wanted to use the "Blue Pill" to radio transmit with the NRF24L01, but I couldn't find any simple instructions. If you are looking to use the NRF24L01 with the "Blue Pill," this is the quick and dirty "How To."

Step 1: What You Will Need.

For this instructable, you will need a few things:

1. 2x NRF24L01 -- The wireless communication board.

2: "Blue Pill" -- stm32F103C

3. FTDI -- The USB to Serial communication device for the programming.

4. Arduino UNO-- or another "Blue Pill."

5. 2x 10uF Electrolytic Capacitors.

6. 1x LED

7. 1x 220 Ohm resistor

8. At least 14 male to female Dupont cables, a large handful of male to male Dupont Cables and two bread boards.

My "Title Shot" shows a breadboard without the FTDI, but with a voltage regulator on the end of the board. Most FTDIs can power the Blue Pill for this project. Also, I created a number of LEDs with a cardboard backing and 220 Ohm resistors pre-soldered for quick prototyping. This is why you don't see the resistor on the board.

Step 2: Setting Up the Transmitter

Here, you have an option between using a "Blue Pill" or and Arduino as the transmitter.

This is the first step in setting up the Arduino transmitter. We will set up the transmitter as the picture shows above. Note that the 10k Ohm resistor to ground is on the same side of the switch as Pin2. After the button is released, the low level leak through the resistor will help the Pin2 go back to 0v. This setup works with the "transmitter_NRFL01.ino" file below.

This is also the first step to set up the Blue Pill transmitter. This setup works with the "STM32_transmitter_NRFL01.ino" file below.

The USB port on the Blue Pill can not be used to upload the Code. There are some hacks that will allow the USB port to be used by flashing an Arduino bootloader onto the chip, but you still need to flash with an FTDI first.
For the sake of not trying to re-invent the wheel, I strongly recommend using this video to learn how to program the Blue Pill. Kudos to Joop Brokking for this Youtube video. It is the most simple explaination I've found. In the illustration above, note the 5v and 3.3v tolerant pins. This is important when starting to use this device. The 3.3v voltage regulator from 5v on the board is subject to overheat and fail if pushed too hard. The more you keep this board at 3.3v, the better. Note that the Pins have different coresponding names in the code than the silkscreened pin on the physical board.

Set up the blue pill as shown above after programming the code. The same applies with the Blue Pill diagram as the Arduino-- the resistor kinda leaks the voltage out to return to normal.

The Capacitor isn't really necessary, but with the small surges of power to transmit, the signal can be compromised and flaky.

In the Arduiino IDE, download and install the RF24 Library.

The Code:

Step 3: The Receiver Setup

Setup your board as the Gimp illustration is shown above. Yes, I know I need to learn fritzing. This is quick and easy Gimp (Graphic Image Manipulation Program).

The Code: