Ubuntu Serial Monitor



When your micro:bit is connected to a computer with a USB cable it is able to send and receive data using 'serial' communication. This is useful for debugging programs as well as data logging, or using your micro:bit as a controller for your computer.

Serial Port Monitor by Eltima This high-quality application delivers a full-featured and comprehensive tool for monitoring COM port traffic. Serial Port Monitor is a solution for discovering and breaking down problems that may occur during the test and optimization COM port devices' performance and more. The serial connection is being made at 115200 baud 8n1, on first serial port, called /dev/ttyS0 in linux (9600 8n1 is the default fall back if your hardware does not support 115200 baud) You are comfortable editing critical system files such as /etc/inittab, /boot/grub/menu.lst You are using a serial (null modem) cable.


Coding serial on the micro:bit

You can send and receive data over serial on the micro:bit using both Python and Makecode for micro:bit.


Python

In Python, the 'print' statement sends a string from the micro:bit to the connected computer over serial. You can read serial messages from the computer using the UART module.

Makecode for micro:bit

Mashup xbmc download.

You can read or write serial data in JavaScript Blocks using the advanced serial blocks.


Ubuntu arduino serial monitor

Using serial on the computer

Once you have programmed your micro:bit you will need a way of sending and receiving serial data on the connected computer using one of these options:

  • In the Chrome browser with WebUSB
  • Using the Windows 10 App
  • Using the Mu Python Editor program
  • Using a computer terminal or serial program.


WebUSB

WebUSB allows you to read serial data in your web browser using the Python or JavaScript Blocks editors. WebUSB is still in beta; we're currently looking for help testing it, and we'd love for you to get involved.


Both editors allow you to stream and plot serial data in-browser. The Python editor also features REPL (Read-Eval-Print-Loop), allowing you to write & test code on your micro:bit in real-time.


Ubuntu Serial Monitor

Note that WebUSB is currently only supported by Chrome.


Discover how to use WebUSB in this knowledge base article.


Using the Windows 10 App

The MakeCode app for Windows 10 allows you to read and plot serial data from the micro:bit, allowing you to accurately log data from the device's sensors.

Connect your micro:bit to the computer with a USB cable then open the MakeCode app. Write a program using the serial blocks and flash it to the micro:bit, then click Show console Device to view a plot of serial data. Clicking the blue button in the right corner will generate a CSV file, which allows you to view and edit the serial data in Excel.


Read this guide to learn more.


Using Mu

The Mu editor for Python allows you to read and plot serial input, and also features REPL (Read-Eval-Print-Loop), allowing you to write & test code on your micro:bit in real-time. Click the REPL button to view raw output from the device, or click Plotter to see a live plot of data from the device


Using a computer terminal

Windows

You can use any terminal emulator program to send and receive data to and from the micro:bit over the USB serial lead.

For example in Tera Term:



  1. Plug in micro:bit and open Tera Term
  2. Select Serial as the port
  3. Choose Setup > Serial port from the setting menu and configure these settings:
  • Baud rate = 115200
  • Data = 8 bits
  • Parity = none
  • Stop = 1 bit


Ubuntu Serial Terminal Program

You should now see serial data output in the console.



Mac OS Foxit pdf macro.

  1. Plug in the micro:bit and open a new terminal window.
  2. Type ls /dev/cu.* to get a list of connected serial devices; one of them will look like /dev/cu.usbmodem1422 (the exact number depends on your computer).
  3. Type screen /dev/cu.usbmodem1422 115200, replacing the 'usbmodem' number with the number you found in the previous step. This will open the micro:bit's serial output and show all messages received from the device.
  4. To exit, press Ctrl-A then Ctrl-D.


Linux

  1. Plug in the micro:bit and open a new terminal window.
  2. Typing dmesg | tail will shows you which /dev/ node the micro:bit was assigned (e.g. /dev/ttyACM0).
  3. Type sudo screen /dev/tty0 115200, replacing the number with the number you found in the previous step. You may need to install the screen program if you don't already have it.
  4. To exit, press Ctrl-A then Ctrl-D.


Ubuntu Serial Port Tool

Further Information

  • One way of handling serial is using the pyserial module for Python. Note that this module is not developed or maintained by the Micro:bit Educational Foundation, so please see the pyserial documentation for support and setup instructions.
  • Another way of handling serial is with Node. See this hackster make for Mac or this make for Windows for more on how to use Node for handling serial.


Ubuntu Monitor Serial Port


Ubuntu Serial Monitor Software

Keywords for search: USB, serial port, Windows, REPL, Mu