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 )
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
Press the RESET Buttonwhile plugging the board, you should see a RED led pulsing
You can, now, connect your board to NRF Connect Programmer
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/
BLE Support is only available on CircuitPython 5.0.0 ! Don't install the current stable release (4.1.2).
In Programmer, Add the 2 Hex Files it should look like this:
Unplug and replug your board, you should see a USB Drive
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 communication
One 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 boardhttps://github.com/maditnerd/makerdiary_circuitpython_test/archive/master.zip
The LED should turn white!
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!
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.
Comments