Make a Stevenson Screen with Arduino Part 2 – Display Numerical Values on an Electronic Scoreboard (7 segment LED)

Make a Stevenson Screen with Arduino Part 2 – Display Numerical Values on an Electronic Scoreboard (7 segment LED)

Raspberry Pi

DSC_0043

This is the second part of our series on how to make a Stevenson screen. In the first part, we were able to get the temperature using a sensor.
To understand the big picture of the Stevenson screen we will be making, let’s take a look at its specifications. We should be “thinking before making.” But with Arduino, you get to enjoy building upon and expanding things while trying out various parts hands-on. I recommend you to”create something with a goal in mind” only after you’re already familiar with a few sensors.
Now, let’s consider the specs of the Stevenson screen.

Today’s Electronics Recipe

Estimated time to complete: 60 minutes
Parts needed:

Specs of the Stevenson Screen

Let’s look up the definition of “Stevenson screen” on Wikipedia.
“A Stevenson screen or instrument shelter is an enclosure to shield meteorological instruments against precipitation and direct heat radiation from outside sources, while still allowing air to circulate freely around them. Its purpose is to provide a standardized environment in which to measure temperature, humidity, dew-point and atmospheric pressure.” 

Under this definition, it seems like it’s okay to call our project an Stevenson screen as long as it has a thermometer (temperature) and a hygrometer (humidity). We were able to work with the temperature sensor last time. In terms of basic features, once we will be able to operate the hygrometer, we will be able to proudly say, “We made an Stevenson screen!”

Now, let’s think a little deeper about the final design details.

What sort of Stevenson screen would be fun to make? Will you enjoy it, and will others be happy with it?
Are there any skills or tools that you currently lack to build this Stevenson screen? By keeping such questions in mind while thinking about the design, you will be able to picture the final design in your head.

When creating something, your work will be polished by repeating this process.

First, let’s think about usability when thinking about the Stevenson screen we will be making.

Arduino plan 2

In the final design, we want the following:

  • The measured values should always be accessible from the PC over the Internet
  • It should operate without being connected to a PC to easily be moved
  • The number of cables connected to the Stevenson screen should be minimized (none, if possible)
  • The measured values should not only be accessible on the PC, but also on the Stevenson screen itself
  • It should be compact (size-wise)

That’s basically what I want for an Stevenson screen that’s easy to use. Now, let’s think about the necessary parts to build it.

  1. The measured values should always be accessible from the PC over the Internet
    → Connect the Stevenson screen to a LAN cable using components such as the Ethernet module
  2. It should operate without being connected to a PC to easily be moved
    → Change the power supply method of Arduino from USB to a DC adapter or batteries
  3. The number of cables connected to the Stevenson screen should be minimized (none, if possible)
    → Go cable-free by not using a DC adapter (solution mentioned above), and by using Wi-Fi instead of a LAN cable
  4. The measured values should not only be accessible on the PC, but also on the Stevenson screen itself
    → Add a display to show the measurements on the case itself
  5. It should be compact
    → We could solder parts onto the base instead of using a breadboard and/or use a smaller Arduino

These are some solutions.
We got familiar with some of these over the course of this series, but not with all of them. So, let’s have a look at each of them.

We did (1) last time. We haven’t done (2) or (3), so we will need to learn how to do them. (4) “Want to view graphs of the data on the PC” is not really an Arduino topic, but rather about displaying data in a browser, so it might require some skills like HTML.
Once you’ve settled on what to build, by adding features one by one, you can develop a detailed plan on how to progress towards completion.
Today, we will learn about the 7-segment LED, to solve (4) “The measured values should not only be accessible on the PC, but also on the Stevenson screen itself.”

What Is a 7-Segment LED?

There are several methods for displaying measurements from analog input on the Arduino. Let’s look in detail at the 7-segment LED, which we touched on briefly last time.

2014-08-29-05.10.12-e1409570497886

7-segment LED

DSC_0029-e1410917121722

Back side of the 7-segment LED

The 7-segment LED (usually abbreviated as 7-seg LED) is an LED made to display numerical values. There are 7 LEDs to represent a digit and 1 LED to represent a dot, totaling 8 LEDs. We will proceed by using a single-digit version, but there are other versions that support 2 or 4 digits. Perhaps, you’ve already seen the 7-seg LED on vending machines? (But recently, more and more vending machines are using touch screens…)
LEDs have an easy-to-understand display, with durable parts, making them a good fit for reliable use, even in a tough environment.

The 7-Seg LED Composition

There are two types of 7-seg LEDs: “common anode” and “common cathode.” The difference is whether the common is anode (positive) or cathode (negative/ground). Since LEDs are directional, if you wire the anode and cathode in reverse directions, nothing will be displayed.

We will use the “common cathode” type of 7-seg LED.

7segLayer 2

The 7-segment LED composition

Displaying the Digits From 0 to 9

You can see from the above diagram that the part consists of the LEDs a-g and the dot DP. By turning these LEDs on and off, we can represent digits. We sketch the ways to display the digits from 0 to 9.
In the below chart, “1” means to run current through it, and “0” means to not run current through it. We will use this chart in our program later.

7segMap

On-off (1/0) chart for the digits from 0 through 9 on a 7-segment LED

For example, to display “1”, we should run a current through b and c as shown below.

1

As you can tell by its name, a 7-seg LED is an LED, so we have to insert a resistor in the circuit. The circuit, when used with an Arduino, is as above.

n_01

Do you have an idea of how it works?
We’ll now create the circuit to display the digits from 0 to 9 on the 7-seg LED. There’s going to be a fair amount of wiring.

7segmentLEDSingle01

Circuit displaying the digits from 0 to 9

By controlling the 28-pin digital outs, we can turn on the specified LEDs.
In reality, it’s a little difficult to use with the Arduino, so we’ll consider a program that counts up from 0 to 9.

Just counting from 0 to 9 takes a long loop in the program.
We would like to shorten the code. It would be nice if we had a function that takes a number as an input and displays it on the 7-seg LED.

NumPrint(number); //Display the specified number on the 7-segment LED

By using the previous chart, we will be able to write a useful function.

The NumPrint function defines all patterns for the digits in Num_Array. Based on this variable, we can easily display the digits on the 7-seg LED by controlling its 7 LEDs.
Below is an example of a program that uses this function to count up from 0 to 9.

The digits lit up from 0 to 9!
But even this program seems to drag on with a long series of similar commands. Since the commands inside loop() are simply incrementing from 0 to 9 and back, we can combine them in a statement. Furthermore, we can also combine the initialization in setup() with the off7SegLED() that turns off all of the LEDs.

Now, our program is ready!

If you want to speed up the counter, with a long program you have to change the delay value in multiple sections. By using a “for” statement, you only need to change it in one place. I recommend you to develop this habit as programming this way will be important as we go on.

Display Two Digits

Now that we know how to display a single digit, let’s try to display two digits. Since, we used pins 2-8 to display the first digit, we can use a circuit with the remainder of the pins (0,1,9,10,11,12,13) to display a second digit.

But considering how complex the wiring was for only the first digit one, we can imagine how intricate it would become. So, let’s create a sort of optical illusion, an electronic trick, or use an idea from a predecessor.

The human eye perceives a very fast sequence of flashing images as motion. With television and movies, we perceive series of 30 and 24 images per second as moving pictures. By using this mechanism, we can easily display two digits by rapidly switching between the two digits.

What about the circuit? By making a relatively simple change to the circuit from the one-digit case, we can also display two digits.

7segmentLEDDouble17

Circuit diagram for displaying 2 digits

It’s different from the circuit we made to display one digit. As we’re adding a second 7-seg LED, we have to add another resistor. Another difference is the connection point for GND. In the previous example, GND was connected on the Arduino, but now it’s connected to pins 11 and 13. You might wondering if it’s ok. It’s confusing, but let’s consider again the HIGH and LOW of digital output.

In the HIGH state, 5V of electricity flows from the Arduino. In the LOW state, it’s 0V.
0V? Then, it’s as though there is no flow = just like GND.

To display 2 digits, we switch between them by turning the pins 11 and 13 on and off in order.

Now, we can display two digits!

There are some new functions in the program, but simple operations are used for each part.
There are other ways to compute the individual digits in a 2-digit number than the one we implemented, so please read up on them if you’re interested.

Reviewing the specifications that we defined at the beginning of this article, we have 2-3 things to learn including using the humidity sensor, and once we build the external case (5), it looks like our Stevenson screen will be complete.

  1. The measured values should always be accessible from the PC over the Internet
  2. It should operate without being connected to a PC to easily be moved
  3. The number of cables connected to the Stevenson screen should be minimized (none, if possible)
  4. The measured values should not only be accessible on the PC, but also on the Stevenson screen itself
  5. It should be compact

Next time, we will shift from having the Arduino connected to our PC to using batteries or a DC adapter as well as learn how to use the humidity sensor. We will be moving quickly towards completing our Stevenson screen!