About the article

PC Serial Perpheral Design (6)

Measurements with sensors

In the previous instalment we measured capacitances and resistances. You may have wondered if this was all worth the effort, when accurate and inexpensive digital multimeters are readily available, but we shall see that we are able to take readings from a wide variety of sensors by measuring their resistance.The best demonstration involves a light-dependent resistor (LDR). Figure 1 shows a simple light-measuring circuit; Figure 2 shows how it might be constructed. In this case we are frequently interested in how the reading changes over time, and this is best shown on a graph.Light measurementIn order to produce a graph on the screen using Visual Basic, we need to use a so-called PictureBox, which can be dragged from the form’s toolbar. It is very important to set the correct size. Visual Basic can use a variety of units and here we want to measure the size in pixels. The ScaleMode property should be set to ‘3 - pixel’, and the box can be dragged out to the correct size using the mouse. For the present example (plotter1.frm) a PictureBox 300 by 500 points is required.
Downloading of this magazine article is reserved for Elektor Members only.
Already a member? click here to log in.
Loading comments...