The LbyM interface is designed to work with Arduino compatible microcontrollers running our software. This allows a call and response type of interface, where the app can request to receive data from a specificed pin, or change an output pin to on or off. Microcontrollers provided by Sonoma State University are made ready to use. If you're doing this without our hardware, you'll need to load the LbyM sketch onto your Arduino compatible board. Contact us for the latest version.
Note: in the current (as of August 2022) version of the LbyM Arduino sketch, a bug results in junk data being retrieved immediately after connecting the board (19279 most commonly). Until a fix has been sent out, this can be avoided by waiting 2 seconds after connecting a board before reading data.
Connecting
With your board plugged into the computer, click "Connect" at the top right of the app. A dialog box should open asking you to pick the device. Look for something labelled "Silicon Labs" in the case of the provided Metro Mini controller. Select this, and verify by clicking "connect". Details may differ in browsers other than Chrome.
If you don't see the dialog box, first make sure your browser is updated. The WebSerial API that we use was released with Chrome 89, and added to other browses at the same time. If you see the dialog box but the device is not available you may need to install drivers. See installing drivers below.
Once the connection you happens the 'connect' button should change to 'disconnect', and an icon should show up in the tab at the top of your browser. Note that only one piece of software can use a device at the same time, so if you have another tab open, or an Arduino IDE, or anything else that may use the board you might not be able to connect.
Commands
The provided sketch is designed to allow you to read data, activate digital pins and control the onboard LED's. The following commands interface with the board. All are single commands with no arguments.
Function Name | Description |
---|---|
readADC0 | Get ADC value of ADC0; replace 0 with appropriate pin number |
readADC 0 | Get ADC value of ADC0; replace 0 with appropriate pin number |
dp2on | Set digital pin 2 to "high" (on); replace 2 with appropriate pin number (2-7) |
dp2off | Set digital pin 2 to "low" (off); replace 2 with appropriate pin number (2-7) |
ob1on, ob2on | Turn on LED found on Metro Mini |
ob1off, ob2off | Turn off LED found on Metro Mini |
read-visible | Read visible light output of I2C sensor |
read-ir | Read IR output of I2C sensor |
There are also abstracted functions that you might run into when using formal curriculum. These include readLightSensor
, readLightSensor0
and readLightSensor1
which correspond to readADC2
, readADC0
and readADC1
respectively.
Installing Driver
If your computer does not automatically recognize the device, you can install drivers. Download the FTDI drivers from Silicon Labs found here (opens in a new tab).
Click 'downloads', select your operating system and follow the provided instructions. For Windows users, download the 'CP210x Windows Drivers', not the 'Universal' or 'VCP' drivers.
Extract the folder onto your computer. On Windows you can usually right click the compressed file and select 'extract here'. For Windows users, open the extracted folder and run the file 'CP210xVCPInstaller_x64.exe'. You may need to provide permission or run as an administrator. If you do not have administrative priviliages on your computer you might not be able to complete the installation.
For more detailed instructions, including for MacOS, see this document. (opens in a new tab) A recent issue has been found with Windows computers in which the board stops working and doesn't appear on the connection options. Reinstalling the driver tends to fix this.
Building a Basic Board
The LbyM boards sent to schools include a Metro Mini Arduino compatible microcontroller placed on a standard breadboard. The microcontroller runs a sketch that responds to the web app. An updated sketch can be provided by request.