I've built several esk8 remote controls using separate Arduio microncontrollers and NRF24L01 radio boards. For this project I want to combine as much as possible onto a single custom PCB using the nRF52832 chip which combines a microcontroller and radio into a single package.
Hand-held devices are small. Wiring up and fitting the buttons, throttle sensor, display, radio, micro, charge controller/cutoff, on/off switch and battery...and making these connections rock-solid and reliable is difficult. You end up with wires all over the place and components hot glued wherever they can fit. The remote and especially the skateboard-side receiver take a lot of abuse, so eliminating as many parts, wires and connections is important for reliability.
The PCB is still weeks from being done, but wanted to prototype a working system using parts I already have: arduino pro micro, nrf2401, OLED display.
I wanted to make sure the .96inch OLED display from Banggood worked. You can drive this display using SPI or I2C. It comes setup for SPI. Changing to I2C requires moving a few soldered resistors on the back. I like I2C because it uses fewer wires and I'm already using the SPI pins to communicate with the NRF2401 radio. I moved the SMD resistor from R3 to R1 and added a jumper wire on R8.
I used the Adafuit SSD306 librarys (Adafruit_GFX.h and Adafruit_SSD1306.h) to drive the display with only one change: The I2C address of the diplay = 0x3C (when setting DC/CS pins to GND)
Various NRF libraries have been around for a while. It's very important to delete and re-install the latest ones. I'm stilling the Aduino IDE. Enabling verbose output on compile shows that even after re-installing the new NRF library, the IDE is still using the object file (.o) from the previous build. You have to delete that (easiest to rm -rf <path> from the terminal) in order for the IDE to re-compile the new NRF library. Doing this saved me countless hours of frustration as I've had inconsistent results (NRF somes not respoding in various sketches) in the past that I'm pretty sure were related to inconsistent NRF libraries. The link above seems to work.
Mess of wires
This is the full-up prototype running on a battery with USB battery charge circuit. The NRF52832 should elimiate all but 9 of these wires: 2 Battery, 3 for the Throttle, and 4 for the I2C display.
It is doing a full round trip communication sending the trottle value and getting back an acknolege message and battey info.
Micro senses throttle postion
Sends the throttle value (0-1023 for now) via the NRF to another board receiving it
Gets an acknowlege message (ack) back that contains: throttle value it got, esk8 battery level.
Displays the (ack) to the screen along with battery info.
Prints "LOST" of there has been no acknowlege message received in 100milliseconds.
Almost done with the PCB v1 (see pic) that combines the SparkFun NRF breakout with a battery charger circuit. I made no changes to the NRF breakout other than move the ISP programming pins to make room for the VCC connection coming from the bottom end. The final version will considerably smaller since it will eliminate most of the unused breakout IO pins..only keeping those needed for the display, throttle, on/off.
The NRF 52832 is Near-Field capable, so I may add a NF antenna and use it for pairing.