Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
94 views4 pages

De2 Electronics 2: Pybench User'S Manual

The document provides an overview and instructions for using PyBench, a microcontroller board designed for an electronics course. PyBench can be powered by batteries and has switches to select operating modes like running experiments or self-tests. It uses a Pyboard microcontroller and files stored on a microSD card to run experiments interfacing various sensors. PyBench can be controlled from a computer by connecting via USB and accessing the microSD card, or from Matlab using a serial connection and custom PyBench code.

Uploaded by

Nowshin Alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views4 pages

De2 Electronics 2: Pybench User'S Manual

The document provides an overview and instructions for using PyBench, a microcontroller board designed for an electronics course. PyBench can be powered by batteries and has switches to select operating modes like running experiments or self-tests. It uses a Pyboard microcontroller and files stored on a microSD card to run experiments interfacing various sensors. PyBench can be controlled from a computer by connecting via USB and accessing the microSD card, or from Matlab using a serial connection and custom PyBench code.

Uploaded by

Nowshin Alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Dyson School of Design Engineering

Imperial College London

DE2 Electronics 2
PyBench User’s Manual

Overview

PyBench is a specially designed board to support the Electronics 2 module in the second
year of our MEng degree programme. The board consist of various module and functions as
shown here:

Power Supply

PyBench can be powered either via the MicroUSB connect on the Pyboard, or through the
screw terminal (green). V+ is between 3.6V and 16V. For Electronics 2, you are provided
with a 6V battery box that takes four 1.5V AA batteries. This should be used when PyBench
is used in an untethered, standalone unit.

Board Configuration Settings

The 3-ways dual-in-package (DIP) switches (red) are used to set the configuration of
PyBench as shown below as a 3-bit binary number.

PYKC version 1.0 2 Feb 2021 1


When all switches are in the ‘0’ position (down), the system runs the user program with a
file name ‘user.py’. Settings 1 (001) to 4 (100) are not used and can be programmed by user
by changing ‘main.py’.

Setting 5 (101) is used to test the bulb board (small PCB used for Lab 3 – Understanding
Systems). It is used to calibrate the sensitivity of the light detecting diode to the bulb
intensity.

Setting 6 (110) is used for self-test. Under this setting, PyBench will enter a self-test mode
after pressing the RESET button (left). Thereafter, pressing the USER button will scan
through four tests in sequence according to the following:

1. Microphone and amplifier test


2. Inertia Measurement Unit (IMU) test
3. Motor test
4. ADC and DAC test

Setting 7 (111) is the normal setting when conducting Lab Experiments. It runs the PyBench
programme ‘PyBench_main.py’ stored on the microSD card and allow the PyBench board to
be controlled via the serial USB interface.

The Pyboard microcontroller module

The Pyboard is a standalone microcontroller system using the ARM microprocessor. It has
been preprogrammed to run MicroPython (uPy) natively. Details on the Pyboard can be
found on: https://docs.micropython.org/en/latest/pyboard/general.html.

The way that we are using the Pyboard is via the MicroSD card, which contains the PyBench
software environment as explained later in this document.

Pyboard brings out many I/O pins, named as X1 to X12 and Y1 to Y12. They are connect to
various components on the PyBench PCB according to the following table:

PYKC version 1.0 2 Feb 2021 2


The physical pin layout of the PYB v1.1 is summarised in the diagram below:

The MicroSD card and PyBench software version 3.0

When you first power up the PyBench system, it tests whether a SD card is present. If yes,
it executes the file ‘boot.py’ which in turn runs the file ‘main.py’.

‘main.py’ examines the 3-ways switch setting and acts accordingly.

Using PyBench with a computer

You can connect the PyBench system to a computer via the USB port of the PYB
microcontroller. The MicroSD card will automatically appear as a disk drive on your
computer running either Windows 10 or Mac OSX. Not driver installation is required. You
can read and write files to the SD card at will.

WARNING: DURING DISK READ AND WRITE, THE RED LED ON THE PYB BOARD WILL FLASH.
DO NOT REMOVE THE USB CABLE WHILE THE LED IS FLASHING. DOING SO WILL CORRUPT
YOUR SD CARD.

You can examine the content of the SD card installed. It contains the PYBENCH_MK2
environment and the following MicroPython (uPy) files:

You can also directly transfer your own uPy programs onto the SD card.

PYKC version 1.0 2 Feb 2021 3


Using PyBench with Matlab via a USB cable

PyBench, under the switch setting of 111 (all DIP switches up), can be remotely controlled
via a serial USB cable. Coupled with another purposed written PyBench.m Matlab program,
the PyBench board becomes a programmable electronics workbench for Matlab. To
initialize the system under this setup, the following is required:

1. PyBench.m must be on Matlab’s search path.


2. Once the USB cable is installed, the following Matlab script is required:
ports = serialportlist; % find the list of communication ports
pb = PyBench (ports(end)); % create pb as a PyBench object

3. Thereafter, the following PyBench methods are available to control the hardware:

Note that when using PyBench with Matlab, you may find that serial communication may be
lost or, in a tight Matlab infinite loop, you cannot regain control of Matlab. If this happens,
you can do the following:

1. Type CTRL+C in Command Window. If this still does not work, exit Matlab and unplug
PyBench cable. Re-start Matlab and connect the USB cable again.
2. Type CTRL+C in Command Window. Enter fclose(instrfind()); or fclose(pb.usb);
will close the serial port.

PYKC version 1.0 2 Feb 2021 4

You might also like