Designing, Building, and Coding Custom Raspberry Pi RP2040 Arduino Devices
CEC Archives | CEC Semester Twenty Four 2023 | Designing, Building, and Coding Custom Raspberry Pi RP2040 Arduino Devices
The overall objective for today will be to code some Arduino sketches that will be adapted to a custom piece of RP2040-based hardware. With that in mind, today we begin our tour of duty in the Arduino programming space. Our first mission will include the task of installing the Visual Studio Code IDE. The mission’s second task involves the installation and configuration of the Arduino for Visual Studio Code extension, which will allow us to construct and compile Arduino sketches from within the Visual Studio Code IDE. The final software tool installation task will consist of the installation of Segger’s J-Flash application that will be responsible for loading our compiled Arduino sketch into our target hardware via a J-Link Pro programmer/debugger.
Following the installation and verification of our RP2040 Arduino Software Development Tool Kit, we will commence with the tasks of writing Arduino sketches aimed at exercising our custom piece of RP2040-based hardware. Our custom RP2040-based hardware design includes a pair of SPI portals, a pair of serial ports, a pair of PWM pin portals, a pair of I2C portals, and some general purpose GPIO pins. The custom RP2040 board was not designed specifically for use with Arduino. The hardware exercise sketches will be the culmination of today’s mission and will demonstrate how to adapt Arduino programming methods to custom RP2040 hardware not originally designed to support Arduino.
The RP2040 hardware we will design and construct today will be able to take advantage of every function available on every RP2040 GPIO pin. Today’s universal RP2040 hardware design can be targeted by any programming language that supports the RP2040 including the Raspberry PICO C/C++ SDK and Arduino. The piece of RP2040 hardware we will assemble today will be used in all of the remaining lectures of this series. Arduino sketches written using our RP2040 Arduino Software Development Tool Kit in conjunction with today’s new universal hardware will be used to create RP2040/Arduino-based IoT projects, which will be presented in the remaining lectures in this series.
Our universal RP2040 hardware is everything to Arduino. However, even with the full power of Arduino behind it, the only way the RP2040 has to communicate with the outside world is by wire. No worries. Today we will reach into our parts bin and pull out enough parts to cobble together a nifty piece of BLE hardware. Then, we will access the Arduino library farm and pull in some code to help us write an Arduino driver for our new BLE radio. After the solder smoke clears and the Arduino BLE sketch compiles, we will establish a BLE link between our universal RP2040 Arduino hardware and a nearby Android phone.
That BLE hardware we added to our universal RP2040 Arduino platform can also be programmed to communicate via Wi-Fi. There is no need to fire up the soldering iron today. All we have to do to get on the shop Wi-Fi network is raid the Arduino library farm again and put together some tricky Arduino networking sketches.
We won’t be clocking the speed of cars on the interstate today. However, we will be detecting motion using a 60 GHz radar module plugged into our universal RP2040 Arduino platform. The radar module has lots of possibilities and we will explore those possibilities with an RP2040 Arduino sketch.

Fred Eady is the owner of EDTP Electronics Inc. and is the principal engineer at the Georgia branch of Ongoing Systems LLC. EDTP Electronics was established in 1988. In the meantime, Fred has written thousands of magazine articles. He has written for all of the major electronic magazines, including Radio Electronics, Electronics Now, Nuts and Volts, Servo, MicroComputer Journal, and Circuit Cellar. Fred has even done a few short feature articles for Design News. To date, he has authored four books and contributed to a fifth. He currently works as a PIC microcontroller consultant and is a Microchip Authorized Design Partner. Fred’s expertise also extends into the ARM community where he is a hardware and firmware design consultant. His customers include aerospace companies, machine shops, specialty startup companies, medical machine manufacturers, coin-operated device businesses, and various other research and development companies. He has a very close working relationship with Microchip Technology, the manufacturer of PIC microcontrollers, and has taught multiple Ethernet and WiFi classes at Microchip's annual Masters Conference.