The Turbidity Tester

Plastic and other garbage in the waters has become a real issue in recent times. To make a difference in the effort of keeping clean the world in which we all live, thousands of YouTube creators have teamed up, lead by Mr. Beast and Mark Rober, to create the #teamseas global campaign, with the goal to raise $30M by the end of this year 2021 to remove from the waters of rivers, seas, and oceans all over the world, an amount of 30M pound of plastic and other garbage. One pound for every dollar.

To do so, #teamseas is partnering with the non-profit charities Ocean Conservancy and The Ocean Cleanup. They pledged to remove the 1 pound of plastic from seas and rivers for every dollar we will collect through the #teamseas effort.

To increase the awareness on this issue, today today I present you a device that can give you an idea of how many pollutants are contained in a sample of water. A corresponding video is also available here.

Here is the schematic of the device, which I named Turbidity Tester.

The sensor that measures the particles dispersed into the water is made of an LED and a photoresistor, on the bottom left.

The photoresistor I used is more sensitive to the green light, and so I used a green LED to make the circuit work at its best.

When the LED shines its light directly on to the photoresistor, the resistance will drop to a minimum, causing the voltage at the non-inverting input of the op-amp to reach a very low value.

When the LED shines its light through a sample of water, the more the water is polluted, the less light will hit the photoresistor and, therefore, the more its resistance will increase, which will cause the voltage at the non-inverting input to raise. The more pollution, the more voltage.

The op-amp is connected in a non-inverting amplifier configuration, and the gain of such amplifier depends on the resistors R3 and R4, which I selected in such a way that I can have on the output of the op-amp a voltage in the range between 0.3 and 8 V.

This voltage is applied to the input of the LM3915, which is a bar graph VU meter driver, configured through the resistors R1 and R2 to work exactly within the same range of 0.3 and 8V.

This way, the VU meter will light up one of the LEDs depending on the amount of pollutants in the water sample.

For the VU meter, I used LEDs of different colors: a blue one for clean water, then green, for less that clean , than orange for dirty water and red for really bad water.

To be able to put a water sample between the LED and the photo resistor, I 3D printed this simple device.

The LED is inserted in one of the side holes, and the photo resistor on the other one, so they will face each other.

The big hole on the top is made of a size that fits perfectly a tic-tac candy container, which will hold the water sample. But of course, if you want to try this project, you can use any kind of transparent container. Just adapt the size of the chamber to fit it snugly.

So, to test some water, we fill the container, we insert it in this sort of chamber, then we power up the circuit, and we take our reading on the VU meter.

This of course is not a device that can take actual measurements of the quantity of pollution in the water, but is an example on how such measurements can be done. Using more sophisticated photo-resistors that can detect different light wavelengths, we could build, using the same principle, a spectro-photometer, and we could tune it up to have precise numerical readings for each frequency. This would enable us to determine not only the presence of pollutants, but also their chemical composition and their quantity.

And talking about pollutants, don’t forget that you can help making Earth a better place to live in by donating to the #teamseas campaign.

Once again, #teamseas is a global campaign to raise $30 M to remove 30 M pound of plastic and trash from our oceans, rivers and beaches. It’s also the second wave of the largest creator-led fundraising campaign to ever hit the internet: #teamtrees. We launched #teamtrees in 2019 with a goal of raising $20M to plant 20M trees and we smashed it, raising over $23M and generating more than 1B video views. Even after two years, teamtrees.org is still receiving donations for planting 2600 trees every day.

#teamseas has partnered up with Ocean Conservancy and The Ocean Cleanup. All donations to teamseas will be split by the two charities 50/50.

Let’s repeat together the success we made back in 2019. Let’s help the world where we live to flourish again.

And finally, here is the archive with all the files for this project:

Happy Experiments!

Advertisement

Making A Small And Fast Computer Using a Raspberry Pi 4B

Converting the Raspberry Pi to use a SSD or a Hard disk via the USB V.3 connector, instead of the microSD card, allows for a big increase in the speed of the device. The conversion can be done very easily with an RPi 4B, since it already has the capability of booting from a USB-attached storage device, but can be easily done also to older RPi versions with a simple modification to their firmware, following the procedure on the RPi official web site.

The conversion consists in removing the microSD card from the RPi and use instead a hard disk. And for that, I bought on Amazon a nice Samsung 500GB external solid state disk for a very reasonable price. Since it connects through a USB v3 cable, it seems perfect for the job.

If you need a SSD like this, or a different one, you could use my affiliate link to buy one, so you will indirectly support this site and the eleneasy YouTube channel at no extra cost to you. You can also watch the video where I show you how to make the conversion.

And since I now have two devices, the RPi and the SSD, that need to stay connected and work together, I decided to 3D-print a nice box to save some desk space.

There are two parts: one for the actual box and one for its cover. They are both made out of a simple cube, but I made a few slits on the bottom of the box and on the cover to help with the air flow, so the components inside will not overheat, especially the RPi.

Here is the OpenSCAD code I used to design the object:

$fa=0.5;
$fs=0.5;


// BODY

difference()
{
	cube([100, 100, 65]);
	translate([2, 2, 2]) cube([96, 96, 64]);
	translate([1, 1, 63]) cube([98, 98, 3]);
	
	translate([5, 20, -1]) cube([88, 2, 4]);
	translate([5, 34.5, -1]) cube([88, 2, 4]);
	translate([5, 49, -1]) cube([88, 2, 4]);
	translate([5, 63.5, -1]) cube([88, 2, 4]);
	translate([5, 78, -1]) cube([88, 2, 4]);
	
	translate([2, 97, 20]) cube([15, 4, 20]);

	translate([35, 97, 10]) cube([56, 4, 20]);
	
	translate([97, 8 , 10]) cube([4, 70, 15]);
}




// COVER

translate([110, 0, 0]) difference()
{
	cube([98, 98, 2]);
	translate([10, 20, -1]) cube([78, 2, 4]);
	translate([10, 34.5, -1]) cube([78, 2, 4]);
	translate([10, 49, -1]) cube([78, 2, 4]);
	translate([10, 63.5, -1]) cube([78, 2, 4]);
	translate([10, 78, -1]) cube([78, 2, 4]);
}

Pleass refer to my YouTube video for the details of the project.

Polarity Inverters

What are polarity inverters and what are used for.

Picture showing images of polarity interter schematics and the title of the post.

Sometimes we design and build a circuit that needs a dual power supply. But, in certain cases, we really need just a positive voltage to power a circuit and the negative is only used for some special polarization that doesn’t really need the same amount of power used for the positive. Consider, for example, a circuit with a depletion channel MOSFET that requires a negative voltage just for the polarization of its gate.

Example of Depletion Mosfet charateristics, where we can see that the gate voltage can be negative.

In such cases, it is economically better to use a different approach than having a full fledged dual power supply. This approach is called “polarity inversion”, resulting in a device that is able to convert the positive voltage of a power supply into a low current negative voltage.

A polarity inverter is, therefore, a circuit that is capable of taking a positive voltage with respect to the ground and generate a negative voltage also with respect to the ground, so that we can have both a positive and a negative voltage available at the same time to power another circuit, without using a dual power supply.

In principle, the inverter is based on the following circuit.

Schematic describing the working principle of the polarity inverter.

There are two capacitors and two diodes, and a switch that connects the positive of the first capacitor alternatively to the positive voltage source and to the ground.

When the switch is set toward the positive voltage, capacitor C1 starts charging through the first diode, which closes the circuit toward the ground. Given enough time, the voltage at the capacitor increases up to the input voltage minus the voltage drop on the diode.

For example, if the input voltage is 9V, the capacitor will charge to about 8.4V.

This is represented in the following diagram by the first pulse on Vin and the corresponding voltage on C1.

Wavw diagrams showing voltages in the various parts of the previous circuit.

Now, once the capacitor is charged, we move the switch toward ground. Doing so, we open the circuit that connects capacitor C1 to the input voltage and, instead, we connect the same end of the capacitor toward ground.

This way, the voltage at the capacitor C1 is now providing a forward polarization to the second diode, the one on the right, and therefore we have a closed circuit that goes from capacitor C1, to capacitor C2 and through the second diode.

If we choose the two capacitors with the same capacitance, half of the charges on capacitor C1 will transfer to capacitor C2 and, as a result, both capacitors C1 and C2 will end up with half of the original charge and, therefore, with half of the original voltage that was on C1.

This is represented by the second part of the above diagram, where now the input voltage is zero, but capacitors C1 and C2 are at half the original voltage.

On the next cycle, we move the switch back toward the power supply, so capacitor C1 is again charged to the input voltage. In this case, however, the second diode is inversely polarized, so capacitor C2 is isolated and cannot either charge nor discharge, thus it keeps the previous value of voltage.

Moving the switch back to the ground, C1 gives now some more charge to C2 and, therefore, its voltage drops a bit while C2 voltage, instead, increases more.

And you can now see that if I keep switching back and forth, adding more cycles to the diagram, both C1 and C2 keep retaining more and more charges, and their voltage keep increasing so that, after a number of cycles, C2 has reached about the same voltage as the input.

Now, note how capacitor C2 is connected to the ground on its positive side, and the other end is offering its negative voltage to the the output of the circuit that is thus negative with respect to the ground.

If you look at the last of the four diagrams, in fact, you can see how the output voltage becomes more and more negative with respect to the ground, with a tendency to reach the 8.4 V we mentioned before.

So, if we keep moving the switch back and forth quickly, after reach that state we can sustain it, even if we remove a little amount of charge from C2 at each cycle, due to a load that we could put across its leads.

This circuit is called a charge pump, because is able to pump charges into the second capacitor, even if it is not directly connected to the input voltage.

Note that if we start applying a strong load to the output, C2 won’t be able to recharge fast enough and its voltage will start dropping. And that is why we cannot use this polarity inverter for loads comparable to those that we can put directly on the original power supply.

But, how do we move a switch fast enough to obtain this functionality?

The trick is to replace the mechanical switch with a a solid state one, and control it with a square wave oscillator, the so called astable multivibrator.

One way to do that is to use a 555 timer, like in the following schematic.

Practical realization of a polarity inverter using a 555 timer.

The circuit on the right half side is exactly the same as the one in the previous schematic. However, on the left half side, the mechanical switch has been replaced with a 555 timer setup as an astable multivibrator, with a duty cycle close to 0.5.

Pin 3 of the 555, which is the output pin, will move alternatively from the voltage of the power supply to the ground, thus working as if it was the switch of the previous schematic.

The oscillation frequency is provided by R1, R2 and C4, which I calculated in this example to provide a frequency of about 30 kHz with a duty cycle very close to 0.5.

If you would like to know more about the 555 timer, I suggest you to watch the video I made about one year ago where I describe what it is and how it works. Here is the link to the video.

In order to be able to support relatively higher currents with the polarity inverter, we need to be able to recharge the capacitors at a faster pace, which translates in a higher current. One way do so is by using the output of the 555 to pilot a couple of transistors with a high value of beta, the coefficient that express the amplification in current of the transistors. With a higher available current, the capacitors will charge faster and, therefore, it will be possible to handle a higher load current.

Here is an example circuit that can provide higher currents:

Practical schematic of the previous polarity inverter adapted to provide a higher current at its output.

This circuit is basically identical to the previous one but, instead of applying the output voltage of the 555 directly to the charge pump, made of C1, C2, D1, and D2, the 555 controls the two transistors 8050 and 8550, respectively an NPN and a PNP.

With these transistors, we can still connect the positive lead of C2 to the positive of the power supply and to the ground alternatively, and we can force the charges in and out of the two capacitors to move at a faster pace.

The two resistors R3 and R4 are necessary to limit the amount of current through the base of the transistors. Too much current in there would have two unwanted side effects:

First, the transistors could burn because of too much current.

Second, even if the transistors did not burn, they would still go deep into saturation, which would make them spend more time moving between the on and off states and causing the circuit not to work as expected.

In addition to that, since the voltage at the output of the 555 does not change instantaneously between 0 and Vin, there would be a period, during the transition, where both transistors would be on at the same time. As a result, the input voltage would be short circuited for a little while during each cycle, which is a condition definitively to avoid.

To fix the problem, I added those two Zener diodes to the circuit. The Zener diodes create a gap between 4.7V and 5.1V that will prevent the transistors from being both on at the same time, thus fixing the short circuit problem.

Here is how it works.

During the transition from 0 to 9V on pin 3 of the 555, transistor 8550 will be on in the interval between 0 and 4.7V.

During the interval between 4.7V and 5.1V both transistors will be off and, finally, during the transition between 5.1V and 9V, transistor 8050 will be on.

Viceversa, during the transition from 9V to 0, the opposite sequence will happen: first, transistor 8050 will be on, then both transistors will be off, then transistor 8550 will be on, alone.

And that is why the two zener diodes make sure that the two transistors will never be on at the same time, thus protecting them and the power supply.

The final effect will still be the same: the positive lead of C2 will be alternatively connected to the positive and to the ground, making the charge pump to work, and creating the negative output.

To conclude, polarity inverters have their usefulness in certain situations, but are not good enough to replace a full fledged dual power supply.

So, when do we use one or the other?

We will use the polarity inverter in those cases where only a little load is required on that specific pole, whereas the majority of the load would depend on the single power supply.

Whenever we need considerable and comparable amount of power on both the positive and the negative poles, we will need to use a dual power supply.

And finally, if you would like to see the polarity inverter in action, you may want to watch this video, which I posted back in December 2020.

%d bloggers like this: