MakePython nRF52840

From MakerFabsWiki
Revision as of 01:31, 22 April 2020 by Hefang (talk | contribs) (Project_1: Display animation)

Jump to: navigation, search

Introduction

Python is one of the most widely used, simple and easy-to-learn programming languages around. CircuitPython is a lean implementation of the Python 3 programming language that has been pared down to run efficiently on microcontrollers.
MakePython nRF52840 is a powerful, generic BLE MCU module target to CircuitPython/MicroPython learners & developers. It is true “breadboard compatible”, with the very detailed pins explanation, it is easy to learn& use. The nRF52840 is ready to take advantage of the considerable performance improvements for Bluetooth Low Energy (LE) with the arrival of the Bluetooth 5 specification. Of greatest importance is the support for longer range (up to x4 compared to Bluetooth 4.x) and doubling of on-air data rate, up to 2 Mbs from 1 Mbs in Bluetooth 4.x
The MakePython nRF52840 leads out all pins of Nordic nRF52840, is programmed with CircuitPython by default, users can begin the CircuitPython developing as getting then on hand. It is also compatible with the Arduino making it easy to get started if the correct bootloader downloaded. There also the Makerfabs MakePython ESP8266, MakePython ESP32 and so on.

Model: MPNRF52840
NRF52840.jpg

Specification

  • Bluetooth Protocols: Bluetooth 5, IEEE 802.15.4-2006, 2.4GHz transceiver/Bluetooth mesh/Thread/Zigbee
  • Bluetooth Data rates: Bluetooth 5: 2 Mbps, 1 Mbps, 500 kbps, 125 kbps/IEEE 802.15.4-2006: 250 kbps/Proprietary 2.4 GHz: 2 Mbps, 1 Mbps
  • Bluetooth Current: 4.9mA peak current in TX(0 dBm)/4.8mA peak current in RX/0.4uA at 3V in OFF Mode, no RAM retention/1.3uA at 3V in ON Mode, no RAM retention, wake on RTC
  • Bluetooth Sensitivity: -95dBm(in 1Mbps BLE Mode)/-103dBm(in 125Kbps BLE Mode)
  • Bluetooth Frequency range: 2.405GHz-2.485GHz
  • CPU: ARM Cortex-M4 32-bit processor with FPU
  • CPU clock frequency: 64MHz
  • Module interfaces: USB 2.0 full speed(12MHz), UART, High Speed 32Mhz SPI, 2x I2C(100kbps/250kbps/400kbps), I2S, LED PWM, GPIO, ADC, SWD
  • nRF52840 Supply Voltage: 1.7V~5.5V
  • On-chip Internal RAM: 256 KB
  • Integrated flash: 1 MB
  • Integrated crystal: 32 MHz crystal
  • Integrated clock crystal: 32.768KHz crystal
  • Timer: 5X 32-bit timers with counter mode
  • Board Supply Power: 5V, Integrated 5V-to-3.3V LDO
  • OLED: 1.3inch SSD1306/SSD1315
  • Recommended operating temperature range: –40 °C ~ +85 °C
  • Board size: 72mm length, 32.6mm width
  • Moisture sensitivity level(MSL): Level 3

Pin Definitions

NRF52840 1.JPG
① FLASH: Button
② Micro USB: USB to serial communication (Also supply power for the board)
③ RST: Reset button
④ SWD: Serial Wire Debug
Notice:
1. P0.26 Connected to OLED’s SDA and P0.27 connected to OLED’s SCL in the board.
2. OLED Driver SSD1315 is the update of SSD1306, compatible with SSD1306.
3. P1.10 connect to control a LED, output low to turn the LED on, output high to turn the LED off.
4. The top side of board(OLED side) microUSB is USB 2.0 port, the bottom side of board microUSB is USB-to-UART(CP2102) port.

Usage

CircuitPython Bootloader

MakePython nRF52840 uses circuitpython programming by default, users can begin the CircuitPython developing as getting them on hand.


Steps to download firmware:
1. Download J-link (If you had already downloaded, skip this step)
2. Connect J-link to the board of NRF52840:
NRF52840 2.JPG

3. Open J-Flash and select:
NRF52840 3.JPG
NRF52840 4.JPG

4. Select nRF52840_xxAA
NRF52840 5.JPG
Interface default SWD and 4000kHz.

5. Download firmware: makepython_nrf52840_uf2_bootloader_5.2.0-71_s140.hex
Open the file and select the firmware you just downloaded (Powered by MicroUSB port)
NRF52840 6.JPG

6. Follow those steps to download:
NRF52840 7.JPG

7. Press RST on the board, you can see a U disk with three files in it.
NRF52840 8.JPG

8. Copy circuitpython-for-makepython-nrf52840.uf2 to the USB disk.


Project_1: Display

1. Click to download the sample file: OLED-SSD1306
2. Copy all the files inside to the CIRCUITPY disk.
NRF52840 9.JPG

3. Click to replace the file in the target
4. Makepython NRF52840 screen displays different characters
NRF52840 30.JPG
5. You can program in code.py to achieve other functions

Arduino Bootloader

MakePython nRF52840 is also compatible with Arduino, if you download the correct bootloader, you can start Arduino development.

The previous steps 1 to 6 of downloading firmware are the same as circuitpython.
Replace the file of step 5 with this Arduino firmware: pca10056_bootloader-0.3.0_s140_6.1.1.hex

Project_1: Display animation

Plug the USB cable into the front MicroUSB port (the side with the screen)
1. Add Arduino board:
NRF52840 11.JPG
Additional Board Manager URLs: https://www.adafruit.com/package_adafruit_index.json


2. In Boards Manager, enter the keyword nrf52840 and install Adafruit nRF52
NRF52840 12.JPG

3. Nordic nRF52840DK(PCA10056) and the corresponding serial port were selected
NRF52840 13.JPG

4. Download and open the example program ssd1306_128x64_i2c:
Show:
NRF52840 27.GIF
NRF52840 29.GIF

File:NRF52840 27.GIF.gif
黃道面看地球自轉的模擬動畫,顯示地球以約23.5度的傾角自轉

Project_2: bluetooth communication

We use the WS2812B RGB LED Module at:
https://www.makerfabs.com/ws2812b-rgb-led-16-bit-ring.html?search=2812
NRF52840 15.JPG

  • Sensor Connection
  • 2.Connect the simple sensor to NRF52840 boards as following:
WS2812 Pins MakePython NRF52840 Pins
DI 30
VCC 5V
GND GND
DO NC

Download and open the sample program Neopixels.ino
NRF52840 16.JPG

Mobile phone download and install a Bluefruit App: Bluefruit Connect_v3.3.1_apkpure.com.apk

Open the APP and search the bluetooth device (open the bluetooth of the phone and locate)
NRF52840 17.JPG

Select Neopixels after connection
NRF52840 18.JPG

Select a color, click on the bottom right corner
NRF52840 19.JPG

The RGB ring will display the specified color
Show:
NRF52840 28.GIF

Project_3: Serial1_test

Because the serial insertion definition of MakePython NRF52840 is different from that of Adafruit, if you encounter problems with the Adafruit sample program, you can try to refer to this method
1. Plug the USB cable into both MicroUSB ports
2. Open the Arduino installation path:
C:\Users\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.19.0
3.Replace the boards.txt file
NRF52840 21.JPG

4. 4.Open the variants in this directory and add the makerfabs_nrf52840 file
NRF52840 22.JPG

5. 5.Open the serial port assistant and select the corresponding serial port (Silicon Labs CP210x USB to UART Bridge)
NRF52840 23.JPG

6. Open Arduino, select Makerfabs nRF52840 and serial port in Tools-> Board/Port
NRF52840 24.JPG

7. Download and open the sample program: Serial1_test.ino
8. Open the serial monitor, you can see the printed ‘Good Day in Makerfabs!’. At the same time, the serial tool displays: Hello, world?
NRF52840 25.JPG

9. When you send information on one serial port, the other serial port can receive this information

FAQ

You can list your questions here or contact with support@makerfabs.com for technology support.

Resources