Modifying/Adding Experimental Parameters to eVOLVER

A Frequent Question:

If I wanted to include additional inputs/outputs for 16 reactors, would I just need to modify the system with more arduinos, or would I also need to add more Raspberry PIs. If this is possible, do you have a rough idea as to how many additional inputs or outputs would start to slow down the system?

This was discussed in our Supplement for our manuscript. If you didn’t have time to dig through the document (I don’t blame you, its 67 pages long), I pasted here for your convenience.

Modifying, Adding, and Removing Experimental Parameters

A key feature of our hardware framework is that it enables adding, subtracting, and modifying components without changing the rest of the system (Fig. S2). For example, if the user wants to add an LED to each culture vessel for dynamic light induction during continuous culture, traditionally this would require redesigning and rebuilding the entire system. In contrast, using the eVOLVER framework, the user can add experimental parameters with minimal modifications to the current system. For example, to add light induction as an experimental parameter, the user could follow these steps:

  1. Modify the Smart Sleeve to incorporate the LED where desired on the device. This involves only redesign of the CMB, the 3D printed tube holder, and the aluminum sleeve. These components are simple to design and fabricate with minimal experience. Template designs are made available at fynchbio.com.
  2. Plug in PCB to corresponding SA slot. The LED must be properly connected to the ribbon cable via the CMB, making an electrical connection to one of the 7 SA slots. To control an LED, a PWM board (same as above) can be used to control the intensity. Alternatively, if the user has additional specific requirements, one could engineer their own custom control PCB to plug into this slot to control the LEDs.
  3. Program the Arduino micro-controller to customize how serial commands translate to LED brightness. First, set up a unique address of the Arduino micro-controller such that the serial commands matching this address will be interpreted by the correct Arduino. Second, custom routines can be programmed to permit rapid computation, sequential actions, or internal feedback. Template routines are made available at fynchbio.com.

To summarize, the additional of experimental parameters is often context specific, meaning it depends on what sensor you are adding and using different strategies to do so. This generally means changing the Smart Sleeve, Adding an Arduino, and making sure the Raspberry Pi is aware of the new changes (to interface with it properly via a simple software change). No additional Raspberry Pi is needed.

Just to add to this, the software changes necessary are pretty minimal on the raspberry pi and in the DPU code. There are essentially 3 changes necessary.

  1. Program the Arduino micro-controller as described above.
  2. Add the serial address information into the server so that it knows how to send commands to the new arduino. You can either add the information directly in this location, or use a websocket event to set it programatically using this event.
  3. In the DPU, add a function in the eVOLVER module to send commands to your new parameter. An example for stir can be seen here. The MESSAGE for stir just contains a list of length 16 with the desired values to be sent to the arduino.

If you want to do something more complicated than sending a simple value to each of the vials for the new parameter, add that logic into the evolver_server.py. A good example of this is the pump logic. The message construction can be seen here, and the logic on the server parsing it out can be seen here.

Hi I’m trying to add a simple command as described above. I have all of the hardware and Arduino stuff done and am working on steps 2 and 3 as described by @heinsz.

For Step 2:
I’m not sure what exact commands I should send based off of the two links provided. Can you provide some example code? It’s possible the code has been changed and the Github link doesn’t point to anything.

For step 3:
This link points to the same place as one of the links in step 2. Is it possible that the code was cut?

@bgwong maybe all of this is out of date?

Hi @Nate_Borders

Configuration parameters have been moved into this file. Now instead of modifying code, you can just add your parameters into the configuration file. By adding a parameter, every time the server runs it’s update loop it will send a message out to your new parameter with whatever information you have it configured to send, then the server will listen for a response from that parameter. In this way you can send commands and receive data back from your param.


Hi Zack,

Thanks for this! It looks pretty simple.

If I want to change my parameter dynamically over time how can I do that?


If you send a command for that parameter from the DPU or the electron GUI, the values in the file will be updated. Is that what you mean?


I think so. So I need to 1) edit the config file to include my new parameter and 2) add a command to change that config file dynamically in the DPU code?

How do I send a command from the DPU?

You can use this script as an example of how to send commands to different parameters - you basically just need to change the param and send it off as a command over the socket. In our experiment code, we typically hide these details in eVOLVER.py, so in custom_script.py you would just call a simple function for the specific thing you want to modulate. As an example, here is a fluid command in custom_script.py. If you follow the logic into eVOLVER.py, you will find the functions that actually use the socket to communicate with the server.

As another example, here is how the electron app sends it’s commands. This function call is general, so it takes whatever parameter is selected and whatever values are set in the app and ships it off to the server when the user hits submit.


1 Like

Thanks for the help so far Zack!

There are a few things I’m trying to do:

  1. Change light produced by an LED based off of OD
  2. Turn off the light when OD is being taken

I’m working through 1, it seems like it’s best to do something similar to the fluid dilution calculations done in custom_script.py and output a MESSAGE to the Arduino.

For 2, I can’t seem to find where the OD command is actually sent

The traceback I did from custom_script.py is as follows:

  1. The OD has been already taken when the turbidostat function is called
  2. These files are made here in eVOLVER.py, (though I’m not sure what the difference between ODSET and OD is)
  3. Data is written to the ‘OD’ file here at the ‘on_broadcast’ function
  4. The ‘data’ that’s being passed to the ‘on_broadcast’ function carries with it the OD values
  5. The ‘on_broadcast’ function isn’t being called anywhere in the eVOLVER.py or custom_script.py code

So at this point I’m stumped. Where is ‘on_broadcast’ being called?

Any help on either of these would be great! Thanks again,

That all sounds correct. The DPU running on the PC is actually a client to the eVOLVER server that is running on the RPi. You probably have seen when you start an experiment that the DPU waits to establish a connection to the server before doing anything. At that point, the DPU just waits for the eVOLVER server to broadcast the latest data it collected from all of the connected arduinos. on_broadcast is a function that is called when the broadcast event occurs from the server to all connected clients, so it is never actually called within the DPU. The timing at which data is broadcast can be configured on the server side. This is why the OD data is already there once the turbidostat function gets called - it’s the first thing to be processed once a broadcast event occurs. Here is exactly where the broadcast event occurs in the server.

So basically if you have a param configured on the server, the data will automatically be sent out over the websocket every time the server sends out data. If you send a command for that parameter over the websocket (with the immediate flag set to true) the server will send that information off over serial to the arduinos.

Commands being queued.
Commands being run.

OD Set is for turbidostat functionality - it’s the current OD threshold (upper or lower) that the code is looking to hit. So once OD hits the upper threshold, OD_Set will be set to the lower threshold, then the eVOLVER will dilute until OD hits that set OD. Then OD set will be set to the upper threshold, and the eVOLVER will wait until OD hits that point before diluting again.

Happy to have a chat about how all this works if this is still confusing, just send me a message and we can set up a time.