# Where are SA slots specified?

**URL:** <https://www.evolver.bio/t/where-are-sa-slots-specified/204>\
**Category:** Uncategorized\
**Created:** [August 21, 2020, 2:29am UTC](https://www.evolver.bio/t/where-are-sa-slots-specified/204 "2020-08-21T02:29:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Schubert](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@Max\_Schubert](https://www.evolver.bio/u/Max_Schubert)\
**Post date:** [August 21, 2020, 2:29am UTC](https://www.evolver.bio/t/where-are-sa-slots-specified/204/1 "2020-08-21T02:29:46Z")

</div>

I’m curious about applications where I’m adding additional LEDs and/or diodes to the eVOLVER setup. If I’m changing the vial board so that “light” is on pin pair 6… where do I update the info such that “light” commands modulate pin 6?

Is this specified in the same way for python as it is for the GUI/touchscreen, in which I can send a “light” command as well?

to clarify, i’m wondering where the specifications like this are kept, and how they can be altered:  
SA Slot 1) Stirring  
SA Slot 2) N/A  
SA Slot 3) Heating  
SA Slot 4) Thermistor  
SA slot 5) IR LED  
SA slot 6) IR Photodiode (90 degree)  
SA slot 7) IR Photodiode (135 degree)  
SA slot 8) N/A

---

<div class="post-metadata">

**Author:** ![bgwong](https://yyz1.discourse-cdn.com/flex035/user_avatar/www.evolver.bio/bgwong/32/262_2.png) [@bgwong](https://www.evolver.bio/u/bgwong)\
**Post date:** [August 21, 2020, 2:47am UTC](https://www.evolver.bio/t/where-are-sa-slots-specified/204/2 "2020-08-21T02:47:26Z")

</div>

All the SA boards are controlled by the Arduinos. All Arduinos listen to the same shared serial RS485 line (along with the Raspberry Pi). When the proper serial command is received, it will interpret the command and respond w/ data.

To be clear, on the Python script (DPU), one might send out a command with the following ( for a simpler example, [see server\_test code](https://github.com/FYNCH-BIO/dpu/blob/master/experiment/server_test.py#L33)):

```
data = {'param': 'temp', 'value': [4095] * 16, 'immediate': True}
evolver_ns.emit('command', data, namespace = '/dpu-evolver')

```

This would be sent via Websockets to the Raspberry Pi where it triggers a command to send all the following commands to the Arduinos. The first position in the ‘value’ array corresponds to vial position 0, 2nd position → vial 1, etc.

All arduinos will see the following command via the shared RS485 but the only Arduino with that particular address programmed into the code will respond to it. There will be a handshake between the Arduino and the Raspberry Pi that everything was properly received.

> temp4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,\_!

Next, the Arduino interprets the array and stores 4095 as the set value for all 16 vials and then responds with what the current temperature readings are that go back to the Raspberry Pi. Please look at the [Arduino code for temperature](https://github.com/FYNCH-BIO/evolver-arduino/blob/master/SAMD21/Rev%20B/RS485_TEMP/RS485_TEMP.ino#L2) as an example.

How the particular code deals with the setpoints is up to the specific program itself. For example, in the temperature code, the Arduino will read the thermistor on SA slot 4 across all 16 vials, compare it to the setpoint via a PID control algorithm, and individually tune the heaters on each vial via PWM (pulse width modulation). The specifics of how you actually control the heater and read the thermistor is hardware specific (though very basic schemes can be used for a lot of applications; e.g. PWM and ADC). The arduino allows you to program a custom, modular script to control whatever sensors and actuators you want to control.

For more information, please read pages 2 - 27 of our Supplemental Information of our manuscript. The bioarxiv version can [be found here](https://www.biorxiv.org/content/biorxiv/suppl/2018/03/12/280867.DC1/280867-1.pdf).

Hope this helps clarify some things.

Brandon

---

<div class="post-metadata">

**Author:** ![Nate\_Borders](https://yyz1.discourse-cdn.com/flex035/user_avatar/www.evolver.bio/nate_borders/32/268_2.png) [@Nate\_Borders](https://www.evolver.bio/u/Nate_Borders)\
**Post date:** [August 27, 2020, 2:31am UTC](https://www.evolver.bio/t/where-are-sa-slots-specified/204/3 "2020-08-27T02:31:55Z")

</div>

I am trying to control an LED using [this](https://github.com/nb-e/evolver-arduino/blob/master/SAMD21/Rev%20B/RS485_OD_LIGHT/RS485_OD_LIGHT.ino) code you gave me, but was having trouble.

I’m using a PWM board that is plugged in to slot 6 and have loaded this on to the arduino controlling slots 5 and 6, however when the eVOLVER is turned on, the LED is on full blast and is unable to be controlled by the GUI or changing the experiment file.

How do I start troubleshooting this?

Thanks

---

<div class="post-metadata">

**Author:** ![bgwong](https://yyz1.discourse-cdn.com/flex035/user_avatar/www.evolver.bio/bgwong/32/262_2.png) [@bgwong](https://www.evolver.bio/u/bgwong)\
**Post date:** [August 27, 2020, 2:55am UTC](https://www.evolver.bio/t/where-are-sa-slots-specified/204/4 "2020-08-27T02:55:07Z")

</div>

Have you populated all the arduinos with the appropriate code? I remember last time you had a blank slot. If it’s trying to ping an arduino and it gets no response it sometimes doesn’t handle it well.

---

<div class="post-metadata">

**Author:** ![Nate\_Borders](https://yyz1.discourse-cdn.com/flex035/user_avatar/www.evolver.bio/nate_borders/32/268_2.png) [@Nate\_Borders](https://www.evolver.bio/u/Nate_Borders)\
**Post date:** [August 31, 2020, 6:59pm UTC](https://www.evolver.bio/t/where-are-sa-slots-specified/204/5 "2020-08-31T18:59:14Z")

</div>

This is our current setup, let me know if the arduino code we’re using is incorrect.

We have [Vial Board Revision C](https://github.com/FYNCH-BIO/hardware/tree/master/vial_board/Rev%20C)

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/evolver/original/1X/0c5f9589bd26c31f296e83952f6aa607b0ce4117.png)

This is our motherboard setup

 ![20200831_142733](https://canada1.discourse-cdn.com/flex035/uploads/evolver/original/1X/34d627343ef2daf14993786969696004a83d1484.jpeg)  
We are running:  
SA Slot 1) Stirring  
SA Slot 2) N/A  
SA Slot 3) Heating  
SA Slot 4) Thermistor  
SA slot 5) IR LED  
SA slot 6) **LED Light source**  
SA slot 7) IR Photodiode (135 degree)  
SA slot 8) N/A

The Arduino code we’re running is:  
Arduino 1) RS485\_STIR  
Arduino 2) RS485\_TEMP  
Arduino 3) RS485\_OD\_LIGHT  
Arduino 4) RS485\_PD

The current problem is that when the eVOLVER is powered on, the LED light source is on full blast. Changing settings in the eVOLVER GUI does nothing, but perhaps this is because the command sent to the light is setting the vial to ‘object’?

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/evolver/original/1X/651761df807dcda48edac56424fcee4294501fb8.jpeg)  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/evolver/original/1X/f1a2b1662e46c0b6d0e668f512bcea937281c1f4.jpeg)

However, I would have thought that the initial LED value would be 0, so the intial state should be off based off of this code from RS485\_OD\_LIGHT:

```
int saved_LIGHTinputs[] = {4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095,4095};

void setup() {
  pinMode(12, OUTPUT);
  digitalWrite(12, LOW);

  Tlc.init(LEFT_PWM | RIGHT_PWM,4095);
  Serial1.begin(9600);
  SerialUSB.begin(9600);
  // reserve 1000 bytes for the inputString:
  inputString.reserve(1000);
  while (!Serial1);

  for (int i = 0; i < num_vials; i++) {
    Tlc.set(LEFT_PWM, i, 4095 - saved_LEDinputs[i]);
  }
  while(Tlc.update());

  for (int i = 0; i < num_vials; i++) {
    Tlc.set(RIGHT_PWM, i, 4095 - saved_LIGHTinputs[i]);
  }
  while(Tlc.update());

}

```

Any help would be much appreciated! Thanks
