MicroPython Pyboard - the microcontroller programmed with Python
Micro Python is a fast, optimized and lightweight version of the Python 3 embedded system programming language.
PyBoard, the Micro Python board is a small electronic board that runs Micro Python in "Bare Metal" and offers a low-level Python operating system to control all kinds of electronic projects.
By opening the Micro Python range, MCHobby begins its 4th documentation project on its wiki.
Python is a very easy to learn scripting language, very expressive, very powerful and has a huge community. By operating on a micro controller, Micro Python makes it possible to flash LEDs without any effort, read voltages, move motors and servo motors, play sound, write/read data on the micro SD card, establish wireless communications (with an additional module) and become that brain that your robot is desperately waiting for. There are so many other opportunities accessible to PyBoard and Micro Python... It's a perfect choice for your next project!
The Micro Python board (PyBoard for intimate) is an electronic development board based on STM32F405 micro controller that runs Micro Python. This micro controller is one of the most powerful micro controllers available on the market and has been specially selected because it would allow Micro Python to operate at its full potential.
The micro controller is cadenced at 168MHz (clock frequency), has 1Mb of Flash and 192Kb of RAM, a very large memory space to write complex Python scripts.
The board includes a USB interface that is presented as a serial device (CDC VCP) and as a removable USB storage device (MSC, the equivalent of your USB key). When PyBoard is connected to a computer, you can open a serial communication program (telnet/minicom or Putty terminal) and interact the board via a Python command line.
The board also behaves like a storage device (a USB Flash drive) allowing you to easily copy your scripts to the file system of the board or SD card. These files can be executed independently of the computer.
See this summary table of the different PyBoard models.
The differences between PyBoard V1.0 and PyBoard V1.1 reside:
- The use of "high-speed" crystal from 8MHz to 12MHz;
- LDO voltage regulator (''Low Drop Out'') which switches from MCP1802 to MCP1703;
- The diode on the USB VBUS power supply is replaced by a "silicon" diode
- Added JST connection with FET protection.
A board for everyone
The Micro Python board is suitable for everyone, regardless of the level of knowledge in programming or electronics. With a few lines of Python code in a text file, the beginner will be able to flash the LEDs and react according to the data of the accelerometer, all without welding, nor component connection, nor installation of software on your computer. Advanced users will appreciate being able to use native types, the iniline assembler or even write their own C programs and upload them in DFU mode.
REPL, Remote Script or Files
Control the board in 3 different ways:
- REPL: Connected on a PC with a USB cable, the board appears as a virtual COM port (USB Serial, CDC VCP) and you can use any serial program to connect to the board and get access to the REPL command line. REPL stands for Read-Evaluate-Print-Loop. This REPL command line allows you to type and execute Python commands instantly, just as you would with a PC. You can also redirect REPL to any UART (serial port) of the PyBoard.
- Script executed remotely: you can switch from REPL mode to REPL raw mode by sending a ctrl-A. Once in REPL raw mode, you can arbitrarily send a Python script to the board where it will be executed immediately. There is a Python script available to make the use of the mode really easy. You simply run python pyboard.py script_to_execute.py and your script script_to_execute.py will be executed on the PyBoard and you will receive the result produced by the script.
- From a file: pyboard has a small file system built into the heart of Micro Python. This file system takes place in a part of the microcontroller's flash memory, as well as on the SD card (if present). When you connect the PyBoard to your PC, it appears as a storage device and you can access the internal file system (via a mount). If you copy a python script to the PyBoard file system and call it main.py then the board will automatically execute this script at startup. This way you can run scripts without being connected to a computer.
Features of the PyBoard
PyBoard is many pins with multiple features. With PyBoard you have on hand:
- 30 GPIO - Input / output pins that can be used for many applications. With a GPIO, you can control LEDs, relays (via transistor or UNL2803), motors (via L293). Read the state of buttons and sensors. Control devices such as LCD screens, graphic displays, expansion cards, etc.
- 2 I2C buses - To control devices using 3 wires.
- 2 CAN buses
- 2 SPI buses
- 5 UARTs - A serial port is a very useful communication tool ... having 5 is absolutely great.
- 20 PWMs - Provides signals to control servo motors or the power of a LED
- 16 ADC - Analog-to-Digital converter for analog voltage reading (convenient for use with flex sensors, photo resistance, potentiometer, etc.)
- 2 DAC - Very rare on the prototyping boards, Digital-to-Analog converters can produce analog output voltages. With this you can produce various types of signals (sawtooth, sinusoid, ... and even sound).
- 13 timers - Timers measure duration and execute code / function at regular intervals. This is an important synchronization element when you want to write advanced applications.
- 16 ext int - External interrupts allows to interrupt the main program to execute code (interrupt function) when a pin changes state. This makes it possible to write programs that react instantly to the change in physical conditions around the board. Example: stop motors immediately if the emergency stop is activated.
- 1 RTC - The real-time clock lets you know the time, measure time laps large enough, create calendar-based executions, and make clocks. The RTC is a useful element that is often missing in prototyping platforms (as is the case for Raspberry, Arduino or Spark Core where the RTC is not used)
- 4 LEDs - LEDs / DELs are useful for informing the user about the status of the program. Having them on the board allows you to quickly test / prototype code without having to make connections.
- 1 Accelerometer - PyBoard was conceived with robotics as a finality. As a result, Damien has integrated an accelerometer on the board. Such a device makes it possible to measure the acceleration (practical case: a falling smartphone) but especially the terrestrial G acceleration on the 3 axes. This earth acceleration responsible for gravity is directed towards the center of the earth, by measuring this acceleration on 3 axes, it is thus possible to determine the 3D position / orientation of the board with respect to the ground (practical case: the automatic rotation of screens on a smartphone, balancing act for a biped robot).
- Microcontroller STM32F405RG (data sheet)
- CPU Cortex-M4 cadenced 168 MHz with 32-bit floating computing unit.
- 1 Mb of Flash memory for storage, 192 Kb of RAM.
- MicroB USB connector with USB serial software support, USB mass storage device, and USB HID (mouse, keyboard).
- connector for micro SD card.
- FreeScale MMA7660 3-Axis Accelerometer (Data Sheet). Up to 64 6-bit samples per second per axis.
- 4 LEDs, 1 Reset button, a user button.
- A 3.3V LDO regulator (low loss) of 300mA. Powered from the USB connector or external power supply between 3.6V and 10V.
- Real Time Clock (RTC) with date and time.
- 30 GPIO input / output pin, 28 are 5V tolerant (except in ADC / Analog-to-Digital mode).
- 2 SPI buses,
- 2 CAN buses,
- 2 I2C buses,
- 5 USART (serial port).
- 14x Analog input with 12-bit resolution, Value between 0 and 4095 (ADC, Analog-to-Digital Converter).
- 2x analog output (DAC, Digital-to-Analog Converter).
- Size of the card: 33 x 40mm.
- Weight of the card: 6 grams.
- Connection on the card: 46 holes with standard impaction of 2.54mm.