# Plugin to run additional photodiode

**URL:** <https://forum.pioreactor.com/t/plugin-to-run-additional-photodiode/90>\
**Category:** Uncategorized\
**Created:** [April 3, 2023, 3:53pm UTC](https://forum.pioreactor.com/t/plugin-to-run-additional-photodiode/90 "2023-04-03T15:53:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![realPeteDavidson](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@realPeteDavidson](https://forum.pioreactor.com/u/realPeteDavidson)\
**Post date:** [April 3, 2023, 3:53pm UTC](https://forum.pioreactor.com/t/plugin-to-run-additional-photodiode/90/1 "2023-04-03T15:53:22Z")

</div>

I want to write a plugin job that will measure the optical density of the media using a second photodiode at a second scattering angle. I want to record its OD measurements to the database and have them displayed on a chart in the UI, ideally with the OD measurements from the first photodiode also displayed. I am interested in seeing how the 45 degree measurements correspond to the 90 degree measurements, and at what range of measurements they are linear/non-linear. I want something that looks like [Figure 5](https://pioreactor.com/blogs/pioreactor/pioreactor-development-log-7). I don’t intend to use this value for calculating a second growth rate, and while it might be nice to have both OD’s normalized, that might be more trouble than it’s worth.

Can you provide some guidance on how I might do this? My Pioreactor has the IR LED in channel A, but channels B, C, and D are all open. Can I use one (or any) of these channels to take the measurements and would I need to update something in the config? Also, should my class inherit from BackgroundJob, or would inheriting from an OD reader class work better? Are there any particular methods I should import?

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [April 3, 2023, 4:10pm UTC](https://forum.pioreactor.com/t/plugin-to-run-additional-photodiode/90/2 "2023-04-03T16:10:02Z")

</div>

The Pioreactor only has two photodiode channels, so max number of signals is two. One signal is typically used for a LED reference signal, but we can sacrifice that. I’ll explain the drawbacks to losing a REF below.

Move the photodiode in REF to the 45deg pocket. In your config, edit `photodiode_channel` to something like:

```auto
[od_config.photodiode_channel]
1=90
2=45

```

That’s pretty much it. `od_reading` will record from both channels and display in the UI, etc.

* * *

Removing the reference PD will effect the signal:

- more sensitive to temperature changes. You may see “waves” during periods of heating. I suggest keeping the Pioreactor away from AC vents, windows, etc.
- the IR LED’s may dim over long periods of time (days), so a decreasing signal could be a dimming LED _or_ a culture change.

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [April 3, 2023, 4:11pm UTC](https://forum.pioreactor.com/t/plugin-to-run-additional-photodiode/90/3 "2023-04-03T16:11:18Z")

</div>

> [@realPeteDavidson](#):
>
> I don’t intend to use this value for calculating a second growth rate, and while it might be nice to have both OD’s normalized, that might be more trouble than it’s worth.

Right, so the way things are set up now, `growth_rate_calculating` will use _both_ signals (45 and 90) to compute nOD and a growth rate.

---

<div class="post-metadata">

**Author:** ![realPeteDavidson](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@realPeteDavidson](https://forum.pioreactor.com/u/realPeteDavidson)\
**Post date:** [April 3, 2023, 4:17pm UTC](https://forum.pioreactor.com/t/plugin-to-run-additional-photodiode/90/4 "2023-04-03T16:17:06Z")

</div>

That’s cool, I’m interested to see how it looks.

Why can’t you use the other channels for the photodiodes? Are they not able to read sensor data? Or do they not have the ADC that the photodiode channels? In general, what can they be used for (what types of I/O do they support?)?

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [April 3, 2023, 4:21pm UTC](https://forum.pioreactor.com/t/plugin-to-run-additional-photodiode/90/5 "2023-04-03T16:21:16Z")

</div>

On the HAT, the two PD channels go through an op-amp circuit to amplify the signal, and then go to an ADC.

The four LED channels are outputs and aren’t wired up for amplifying signals. They can be used for adding more LEDs, ex: white light, red light, etc. for photosynthesis or optogenetics, etc.

In general, they produce controllable current between 0 to 100mA. We’ve only ever used them for more LEDs.
