Connect a PicoBoard on Linux

PicoBoard Recently, I came across a forum post somewhere that mentioned the PicoBoard (formerly called a Scratch Board) worked in Linux. So, I set off to see just how easy it would be to get my PicoBoard working on Ubuntu 9.10.

Picoboards provide external sensors that feed input from the real-world into Scratch. The sensors are light, sound, resistance, button clicks, and slide control. And they’re a blast to use. I highly recommend them.

First stop, the PicoBoard driver download page. First the good news. There must be people requesting Linux drivers because the page supplies the ftdi_sio Serial to USB kernel driver as a download.

No Driver Download Required

The driver file on the download page is actually the FTDI USB Single Port Serial Converter. And if you visit the Sourceforge page for the project, you’ll find this advice from the previous project maintainer, Bill Ryder:

Use the most up to date linux kernel. This means 2.6.x or at least 2.4.30. The driver is included. I only ever use 2.6.x kernels so if you are using 2.4.x you are on your own. The driver is marked experimental at the moment. But I’m going to change that because it isn’t experimental any more.

Still, Scratch wasn’t detecting my PicoBoard. Though Linux was detecting the PicoBoard when I plugged it in the USB Port.

Load the Module

The ftdi_sio module is included with the kernel, but it wasn’t loaded for me. Here’s the command to load it:

sudo modprobe ftdi_sio

Now make sure the PicoBoard is plugged in and restart Scratch. The dmesg command is your friend here. It will give you feedback about how Linux is seeing the board. Here’s the last few lines of my dmesg output:

[451394.964027] usb 4-1: new full speed USB device using uhci_hcd and address 5
[451395.140265] usb 4-1: configuration #1 chosen from 1 choice
[451395.144909] pl2303 4-1:1.0: pl2303 converter detected
[451395.164947] usb 4-1: pl2303 converter now attached to ttyUSB0
[451470.917714] USB Serial support registered for FTDI USB Serial Device
[451470.917840] usbcore: registered new interface driver ftdi_sio
[451470.917843] ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver

The first four lines is the kernel detecting the device. Then remaining lines appeared when I loaded the ftdi_sio module.

A sample script

Here’s a quick script to test out the PicoBoard. Cameron is going to love this, especially when we combine it with the webcam support.

If you run into problems, I can’t say that I will have the answer, but I’ll definitely try. Feel free to ask for support.

12 thoughts on “Connect a PicoBoard on Linux”

  1. We just got a PicoBoard for scratch and 10 minutes After following your instructions we were able to move a sprite when A was connected – amazing scratch recognized it out of the box NO download at all – using Ubuntu 10.4 and picoboard bought in 2011 – We would like to output a signal – is that possible?
    Thanks

  2. Hi Floyd and Kate,

    First, thank you for the feedback. I’m think Scratch and Picoboards are great fun.

    I’m not sure I understand your question, however. The Picoboard outputs a signal to Scratch, which you can use via the sensor blocks. Sounds like you have that part down. If you’re question is about going to the other way, outputting a signal from Scratch, then that’s not possible, at least not to my knowledge and definitely not without some hacking.

  3. Thanks for this web page. When I try to connect my Picoboard to an old laptop with a new Ubuntu (11.10) and look in the output of dmesg, I find these lines:

    [ 6383.947211] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
    [ 6383.947242] usbcore: registered new interface driver ftdi_sio
    [ 6383.947245] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
    [ 6959.563912] generic-usb 0003:0694:0003.0002: implement() called with too large value -128! (scratch_squeak_)

    Maybe that last line has something to do with why the Picoboard isn’t working. Do you have any idea what might be causing that problem or how to fix it?

  4. OK, I got this working, with the help of my very able husband. It turned out to be a permissions problem. I will describe how we found and solved the problem here, in case it proves useful to anyone else.

    First, to check if the Picoboard was being recognized correctly, we did (in a terminal window)

    tail -f /var/log/syslog

    in order to monitor what was happening with the system, then plugged in the Picoboard. Some new lines were printed out, the last 3 of where were something like:

    ….FTDI USB Serial Device converter now attached to ttyUSB0
    ….bus: 5, device was not an MTP device
    ….WPA: Group rekeying completed with

    Hubby said this looked good, so we thought we’d try to get Scratch to tell us what was going on. We started Scratch not from a GUI, but just by typing “scratch” into a terminal window, not even putting it into the background. That way any error messages would be printed to the terminal.

    I plugged in the Picoboard and brought up the ScratchBoard watcher. The terminal window now said

    Error opening serial port /dev/ttyUSB0 – permissions denied(13).

    So we did

    ls -l /dev/ttyUSB0

    and it said

    crw-rw—- 1 root dialout 188, 0 2012-06-26 1-:15 /dev/ttyUSB0

    Ah, ha! I (myra) don’t have read or write permissions for this file. But the “dialout” group does. So the solution was to add me to the dialout group. So we did

    sudo vi /etc/group

    (replace vi with your favourite editor). The dialout line looked like this:

    dialout:x:20:skr

    (skr is hubby). I changed it to add me:

    dialout:x:20:skr,myra

    Then I logged out and back into the computer to allow the group changes to take effect, then the next time I started Scratch it worked! Hooray!

  5. Wonderful Myra,
    I have ubuntu 12.10. it loads the driver will, but scratch has no right to ttyUSB0

    change the rights and all works well!

  6. Does Scratch lock VID/PID of FTDI chip ? If not, then any legacy Arduino can simulate a picoboard with proper C++ code. Do you have any information for the interface protocol between Scratch and picoboard ?

  7. I have noticed you don’t monetize scratchguide.com, don’t waste your traffic, you can earn extra bucks every month with new monetization method.
    This is the best adsense alternative for
    any type of website (they approve all websites), for more details simply search in gooogle:
    murgrabia’s tools

Leave a Reply

Your email address will not be published. Required fields are marked *