Circuitpython On Makerdiary Nrf52840
About the project
Install CircuitPython on MakerDiary NRF52840-MDK USB Dongle
Project info
Difficulty: Easy
Platforms: Nordic Semiconductor
Estimated time: 1 hour
License: Creative Commons Attribution CC BY version 4.0 or later (CC BY 4+)
Items used in this project
Story
While I really like the ESP32 chip, I wanted to play with the NRF52840 which is a pretty neat chip!
So I bought MakerDiary NRF52840 Usb Dongle which doesn't cost too much ($12.99)
https://store.makerdiary.com/products/nrf52840-mdk-usb-dongle
Here is some characteristics :
- Bluetooth Low Energy
- Power efficient
- It's really small
- NFC tag
- RGB Led
- And most of all compatible with CircuitPython (thanks to gpshead )
Nordic Semi Product Brief document
Nordic Semi Product Brief document
Source: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52840
Let's see how to install CircuitPython, then we test it with a small example to control the RGB Led using BLE
Install NRF ConnectFirst we need NRF Connect, we will use this software to upload CircuitPython on our board.
You can download it here : https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop
Click Install on Programmer
Put the board in bootloader mode
Press the RESET Buttonwhile plugging the board, you should see a RED led pulsing
You can, now, connect your board to NRF Connect Programmer
Download Adafruit NRF52 Bootloader and CircuitPython
We need 2 hex files to install CircuitPython
- A bootloader, which will make our board visible as a USB drive
- CircuitPython to interpret our python code
Download mdk_nrf52840_dongle_bootloader-X.X.X_sXXX_X.X.X.hex here :https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/
Then download CircuitPython here : https://circuitpython.org/board/makerdiary_nrf52840_mdk_usb_dongle/
Upload Hex files
In Programmer, Add the 2 Hex Files it should look like this:
You need a SoftDevice to upload your program, but it is included with the Adafruit NRF52 Bootloader
You need a SoftDevice to upload your program, but it is included with the Adafruit NRF52 Bootloader
Unplug and replug your board, you should see a USB Drive
Winner Winner Chicken Dinner !
Congratulations you can now code using CircuitPython !
You won't be able to access your board with NRF Connect now, If you need to upload a new program, just press reset. Testing BLE communicationOne cool thing, with CircuitPython is that we just have to drag and drop file to make it works!
So let's try that, download this program and copy it into your board
https://github.com/maditnerd/makerdiary_circuitpython_test/archive/master.zip
The LED should turn white!
Control the RGB LED
You should also be able to control the LED using your phone.
- Download Adafruit Bluefruit LE Connect on your app store
- Connect to CIRCUITPY****
- Go to Controller / Color Picker and try to change the color!
Code your own program
You can now follow Adafruit Tutorials, code made for Adafruit NRF52840 should works fine!
- CircuitPython tutorial : https://learn.adafruit.com/welcome-to-circuitpython
- Bluetooth LE tutorial : https://learn.adafruit.com/circuitpython-nrf52840
- Libraries : https://circuitpython.org/libraries
You can use whatever software to code, but https://codewith.mu/ is recommanded.
Each times you save code.py, the code will restart, check the Serial Port for errors and debug information.
Leave your feedback...