Autonomous Research Laboratories

A self-driving (autonomous) laboratory optics demo using dimmable LEDs and a spectrophotometer. <$100, <1sq.ft, <1 hr setup.

Public Chat
Similar projects worth following
We need new materials faster than ever before to solve the world's challenges such as climate change, plastics pollution, and cancer. Self-driving laboratories (autonomous research laboratories) can accelerate the time-to-market from 20 years and $100 million to as little as 1 year and $1 million. However, the barrier to entry for researchers is high in terms of both capital and multi-disciplinary expertise required (hardware, robotics, electronics, artificial intelligence, simulations). There are several excellent low-cost platforms and demos that help reduce barrier-to-entry; however, for wider adoption, we need something that is cheaper and easier to set up. We propose SDL-Demo: a "Hello, World!" for teaching and prototyping self-driving laboratories using a Raspberry Pi Pico W microcontroller, an RGB LED, a light sensor, and optimization algorithms.

Note: much of the content here are snippets from See also the most recent version of the manuscript (as of 2022-09-10).
While there are several excellent platforms in chemistry and materials science for low-cost self-driving laboratories (SDLs) [1, 2, 34, 5, 6], for wider adoption of a demo, it needs to be cheaper, smaller, and simpler to set up while still preserving the functional aspects of a materials acceleration platform (MAP). In programming, a minimal working example (MWE) “is a code snippet that can be copied and pasted into an empty ... file and still have the same features (working), and that does not include unnecessary details (minimal). [7]” Here, we pose the question:
What does a minimal working example look like for a self-driving laboratory?

We introduce the idea of a self-driving optics demo for less than $100, a square foot of desk space, and an hour of total setup time. See the following video for a 2-minute introduction of how this works:

We believe our demonstration adequately meets the minimal, complete, and reproducible requirements of a MWE SDL (Table 1)

ProgrammingSelf-driving Laboratory
MinimalUse as little code as possible that still produces the same problem [7]Minimize the cost, size, and setup while still being an SDL
CompleteProvide all parts needed to reproduce the problem in the question itself [7]Provide software with documentation and a bill of materials with setup instructions
ReproducibleTest the code you’re about to provide to make sure it reproduces the problem [7]Benchmark the SDL using a fixed configuration and verify the results are expected

as well as the high-level definition of a MAP (though not materials specific):

[A system that] carries out high-throughput and/or automated experiments, the results of which are fed back into the AI that guides the selection of subsequent rounds of experimentation to optimize or make a discovery.

The demonstration involves controlling the brightness of light-emitting diodes (LEDs) at fixed wavelengths, sensing the light mixture via a discrete-channel spectrometer, decision-making to tune the inputs to best match the desired spectrum, and optionally, cloud-based simulations to aid in decision-making. The setup is summarized in Figure 1.

Figure 1: Summary of the self-driving laboratory demonstration (SDL-Demo). A microcontroller (Raspberry Pi (RPi)) sends commands to a dimmable red green blue (RGB) light-emitting diode (LED) to control the brightness at different wavelengths. A spectrophotometer measures the light signal at eight individual wavelengths. The microcontroller reads the intensity values from the spectrophotometer and uses these newly measured values and prior information (including e.g. prior measurements and physics-based simulations performed in the cloud) to choose the next set of LED parameters in an effort to better match a target spectrum. The setup adequately meets the minimal requirement of a minimal working example (MWE) self-driving laboratory (SDL) by costing less than 100 USD, occupying less than 1 ft2 (0.1 m2) of desk space, and requiring less than 1 h of setup time.

For more context, see a recording based on my talk at the 2022 acceleration conference in Toronto.

Build Instructions


[1] D. Caramelli, D. Salley, A. Henson, G. A. Camarasa, S. Sharabi, G. Keenan, L. Cronin, Networking chemical robots for reaction multitasking, Nature Communications 9 (2018) 3406. URL: doi:10.1038/s41467 -018-05828-8, number: 1 Publisher: Nature Publishing Group.

[2] T. Fuhrmann, D. I. Ahmed, L. Arikson, M. Wirth, M. L. Miller, E. Li, A. Lam, P. Blikstein, I. Riedel-Kruse, Scientific Inquiry in Middle Schools by combining Computational Thinking, Wet Lab Experiments, and Liquid Handling Robots, in: Interaction Design and Children, ACM, Athens Greece, 2021, pp. 444– 449. URL:

Read more »

View all 10 components

  • Basic tests with Pico W

    Sterling Baird08/24/2022 at 06:09 0 comments

    I soldered headers for two Pico W's. Unfortunately, one of the boards seems to be fried, or maybe it's a short-circuit that I need to go in and fix. Either way, my laptop wasn't recognizing it. Soldering iron was non-adjustable in terms of temperature, the soldering wire I had available was thick, and I had trouble with the debug headers. I'm pretty sure it was when I was messing with the debug headers that I messed something up with the RP2040 processor right by it. For the second attempt, I soldered underneath with the black casing of the header pins on top so that I wasn't poking the soldering iron around the surface mount electronics.

    I inserted the headers into the Maker Pi Pico base to act as the soldering mount (similar to the guide here) and taped the Maker Pi Pico base to the table I was working at. I watched a video, though I think the tutorial I linked previously would have been good to go through first. Even better, I should have gone out and bought thinner soldering wire and been more careful where I put the hot soldering tip.

    Many of the indicator LEDs on the Maker Pi still light up for the Pico W that wouldn't connect, but I'm not sure if that means it's worth it to try to fix.

    After that, I set up VS Code with the CircuitPython extension and started testing out the Pico W. `circup` made it pretty easy:

    pip install circup
    circup install neopixel
    circup install adafruit-circuitpython-as7341

     (maybe instead of neopixel I should have installed adafruit-circuitpython-neopixel, but it worked nonetheless).

    I guess the cached directory was getting larger than the drive storage allowed due to mypy linting, so I made it so it caches elsewhere via a .vscode/settings.json file with the --cache-dir mypy argument:

        "python.linting.mypyArgs": [
            "--cache-dir=C:/Users/<my username>/.mypy_cache",

    I ran an AS7341 example and the Maker Pi Pico Neopixel example. See a snapshot of those examples here. I was able to control the NeoPixel brightness and RGB values and read the spectrophotometer measurements.

    Next, I need to set up a web server per these instructions. Oof, do I need to switch to using MicroPython instead of CircuitPython? I think probably not.

    Read more »

  • 5 Pico W's just came in

    Sterling Baird08/18/2022 at 02:06 0 comments

  • Mounting

    Sterling Baird08/18/2022 at 01:44 0 comments

    For my first mounting test, I used what was on hand and formed strips of aluminum foil around the wire and added an arm to support it. While it had a nice trade-off of maintaining its position and adjustability, it was too kludgy. I ordered some sculpting wire from Amazon and tried a near-identical setup to the Al foil, but it was also lacking. Unfortunately, the wire was too large to fit through the mounting holes. So, instead, I wrapped the wire around the Blinkt! module and fastened the wire using fishing line.

  • Redesigned for Pico instead of Zero 2 W

    Sterling Baird08/13/2022 at 23:27 0 comments

    • Adafruit Pico version bill of materials
    • For mounting (all versions), thick sculpting wire wrapped around Stemma-QT cable
    • I ordered 5 Pico W's with unsoldered headers at PiShop instead of Adafruit (out of stock)
      • I couldn't find a solderless JIG for the Pico W, but maybe someone will come up with one eventually
      • When the Pico WH is available (and assuming it can be sourced), this is the preferred option
      • The Maker Pi Pico is a version that comes with the Pico directly soldered on, but this didn't seem to be in stock, and I'm not sure if it would come with the Pico W

    The key difference in the switch from RPi Zero 2 W to the RPi Pico W is the Blinkt! module has been replaced by a single NeoPixel LED on a Maker Pi Pico base. The Maker Pi Pico base has Grove ports instead of Stemma-QT, so a Grove to Stemma-QT adapter is included in the parts list. 

    Maker Pi Pico has an example script for the NeoPixel LED. Setup for the Pico can be found in this Adafruit guide or similar guides.

View all 4 project logs

  • 1
    1. Order the required parts
    2. Set up your RPi Zero 2 W
    3. Hammer on the GPIO pins using the installation JIG
    4. Hookup the Stemma-QT SHIM to the RPi GPIO pin headers
    5. Attach the Blinkt! module to the RPI GPIO pin headers
    6. Set up the Blinkt! library
    7. Connect the AS7341 to the Stemma-QT SHIM via a Stemma-QT cable
    8. Set up the AS7341 library
    9. Run a script that uses Blinkt! and AS7341
  • 2
    Order required parts (see also optional suggestions and considerations below)


    self-driving-optical-demo-zero are the minimal required parts for a self-driving optical demo using the Raspberry Pi Zero 2 W as the microcontroller. If you have trouble getting an RPi Zero 2 W, other RPi Zero models should also be directly compatible, though might not support wireless (W). Banana Pi M2 Zero might also be an option. Optional additions to this demo are in self-driving-optical-demo-zero-optionals


    This description is not meant to be a comprehensive guide; rather, it's to point out some key takeaways from the product descriptions that affect which optional parts should be bought together, bought instead of another, etc. See the product description pages for more information.


    While technically optional, I highly recommend purchasing PID:954 from the optional list. This is to provide an additional way of accessing the RPi in case you run into problems setting up the RPi (I did my first time) and you don't have a compatible display, keyboard, and mouse available to interface with the RPi directly.

    With vs. Without Headers

    If you can source the RPi Zero 2 W with headers pre-installed, great! In this case, you can purchase that instead of Raspberry Pi Zero 2 W PID: 5291 + GPIO Hammer Headers - Solderless Raspberry Pi Connectors - Male + Female + Installation Jig PID: 3413. At the time of writing (2022-07-09), RPi Zero 2 W with headers installed was not listed on Adafruit to our knowledge. If you know how to solder or want to learn, and have access to soldering equipment, see (i.e. you can replace PID:3413 with PID:2822).

    Blinkt! Covers Too Many Pins

    The Blinkt! covers all 40 GPIO pins. The Stemma-QT shim allows for using the AS7341 spectrometer by having an adapter that sits in-between the pins and the Blinkt!. If you want a configuration that allows easier access to the pins covered by Blinkt!, then see PID:3182 and PID:1988 from the optionals list. 


    self-driving-optical-demo-zero-optionals are optional parts to a self-driving optical demo using the RPi Zero 2 W (other RPi Zero modules should work fine, but keep in mind whether wireless/WiFi (W) is supported or not for the model). See for required parts.

    Standalone Setup

    If you want to use this completely standalone with nothing other than a US 2-prong electrical outlet to plug into, you will need a display, keyboard, mouse, and preferably a stand for the display (see below). Feel free to swap these out with whatever you'd like, but the options here seem to be the cheapest / most straightforward for making it standalone. I probably spent too much time looking at all the options. The rabbit hole is free to explore if you'd like, but in the end, a plug-and-play display for the RPi is usually at least ~$50, and bigger displays are more expensive. If you choose a standalone setup (no access to an external computer), PID:939 from the required list becomes optional, as you don't need to read/write the micro-SD using a separate computer. 


    For a display, I recommend choosing between either HDMI 4 Pi: 5" Display (no Touch) w/Mini Driver - 800x480 HDMI PID: 1928 OR Adafruit Mini PiTFT 1.3" - 240x240 TFT Add-on for Raspberry Pi PID: 4484. If you choose PID:4484, then note you won't be able to use this "out-of-the-box", and need to do some setup through a separate monitor/computer first, but you can still expose a terminal this way. The latter is super tiny, so don't plan on using a typical desktop GUI with it.

    Access Unused Pins

    To expose additional GPIO pins for other applications or interesting modifications you want to implement (since many of the pins are unused), you can use the Pimoroni Mini Black HAT Hack3r - Fully Assembled PID: 3182 + GPIO Ribbon Cable for Raspberry Pi Model A+/B+/Pi 2/Pi 3/Pi 4 - (40 pins) PID: 1988. Just keep in mind which pins are already being used when you make modifications.

    SD Card Reader

    If you're not using a standalone setup (i.e. you'll access the RPi from a separate computer), and your computer has an SD slot, you can use the slightly cheaper White Shortening microSD to SD Card Adapter PID: 5447 instead of PID:939 (I'm mentioning this because PID:939 is listed on the "required" list). I assumed everyone's computer will have a USB port, but not everyone will have an SD card port.


    Lmk at the email listed on my GitHub page under "How to reach me", write an issue on the GitHub page for this projectleave a comment on the hackaday project, message me on Twitter or LinkedIn, etc.

  • 3
    Set up the Raspberry Pi
    Large portions are copied from AdaFruit overview instructions for Raspberry Pi Zero. There are likely similar guides which can also be used.

    This guide shows how to bring up a Raspberry Pi Zero, Zero W, or Zero 2 W without needing to attach a keyboard/mouse/monitor. Basic settings will be configured by editing text files directly on the SD card using an editor on your main PC prior to first boot.

    Latest OS tested: Raspberry Pi OS Buster Lite 2021-05-07

    In this guide the term "Pi Zero" will be used for all the Pi Zero models.

    Suggested Items

    If you need to troubleshoot for any reason, this item is your best friend. For $10, it makes working with a headless Pi Zero so much easier. It's also included with a lot of the kits.

    • raspberry_pi_usb_console_cable.jpg

    USB console cable.

     Don't leave home without it.

    This is a slightly fancier option specifically made for the Pi. It has the convenience of allowing you to use a standard micro USB cable. It was mainly designed for attaching to male headers, so if you've soldered on something different you'll have to find some way to jumper it.

    • raspberry_pi_3589-01_small.jpg

    Adafruit PiUART - USB Console and Power Add-on for Raspberry Pi

    Of course you'll also need an SD card for the operating system, a Pi Zero (plus WiFi adapter) or Zero W, and some form of header pins to access the GPIO.


    Install and run the rpi-imager and then follow the directions on-screen. Be sure to enable SSH, set a password, input your WiFi details, and select the Raspberry Pi OS. You're fine to leave the hostname as the default (raspberrypi) or you're welcome to change it.

    Enable SSH and set a password


    Input your WiFi login information

    pi_zero_Screenshot_from_2021-09-02_15-05-15.pngChoose the Raspberry Pi OS

    pi_zero_Screenshot_from_2021-09-02_15-23-58.pngEnsure that your SD card is mounted to your computer (this is why there is a USB MicroSD Card Reader/Writer - microSD / microSDHC / microSDXC included in the required parts list), and write to the SD card (not your hard drive!)

    Click CHOOSE STORAGE to pick the SD card to use. Be careful to select the correct device here.

    Make sure you select the SD card and not your hard drive.


    Give It Life


    OK. Let's power it up.

    With the SD card inserted, apply power via a USB cable to the PWR IN connector as shown.


    You should see some activity on the green LED light. This means the Pi Zero found a good OS image and is booting.

    After a minute or two, you can try and ping the Pi Zero to see if it has connected to your network. You can access the Pi Zero using mDNS style addressing.

     Download File Copy Code

    ping -c 3 raspberrypi.local

    Windows users will require some additional setup. Read here. Also, the ping options on Windows are different, so the above would be:

     Download File Copy Code

    ping -n 3 raspberrypi.local


    You should also be able to ssh into the Pi Zero.

     Download File Copy Code

    ssh pi@raspberrypi.local

    The default password is raspberry.


    If that worked, then you're pretty much done with the RPi setup. The Pi Zero has connected to your network, and assuming your network is connected to the Internet, so is the Pi Zero. If you want, you can read the Suggested Initial Setup section for some suggested first steps.

    If that did not work, it's time to troubleshoot. Go to the Using A Console Cable to Troubleshoot section.

View all 16 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates