Home        Kenley Weather     Guestbook

Section   Top  Specs   Intro   Background  Schematic Construction   Reading The Displays  Code

 

 

 

Arduino Barometer

 

SITE UNDER CONSTRUCTION

Using an Arduino UNO and Nano to display Air Pressure on an analogue display using 3 stepper motors

Air Pressure in hPa (hectopascal) is displayed on the large main dial and is updated every 10 minutes.

There are 2 secondary dials, one shows the last 6 hour pressure change and the other shows the last 3 hour pressure change.

The 3 hour dial has an increased resolution of 0.5 hPa as this is used for weather forecasting.

There are LEDs to show when extended range is in use on all three displays and also LEDs to indicate the weather forecast off the 3 hour display.

Inside the case  two 20x4 LCD screens  show info from each of the microprocessors.

The main air pressure display and 6 hour display are controlled by a RTC. This clock also provides a 1 hour pulse for the 3 hour display.

 

 

Classic Style in 12" Clock Case  Modern Style in 300mm (12") picture frame with shadowbox

 

 

 

 

 

Extended Range Dials

All three dial have extended ranges. This allows larger displayed resolution on the dials.

The animation below shows how the LEDs light when extended range is in operation.

The Red LED shows when the reading is +5 and above. You would then read the Red scale lettering.

The Green LED shows when the reading is -5 and below. You would then read the Green scale lettering.

If the reading goes beyond the extended range eg on this dial above +9 or -9 both LEDs will light to show this- see next section.

 

 

 

 

 

Pressure readings Over Extended Range

If the pressure reading is over the extended range + or - then both LEDs will light to warn you that extreme readings or changes have taken place.

The dials will actually still show the readings eg on the 3 hour dial if the reading was -10 then the dial would point to 0 with both LEDs lit.

If the 3 hour reading was -11 then the dial would point to -1 with both LEDs lit. You just add 10 to the reading.

In the animation below the 3 hour pressure difference is starts at 0 and the pressure difference is going down.

At -5 hPa the green LED lights to indicate negative extended range is in use.

The pressure change keeps dropping until it reaches  -10hPa. This is now over the extended range so the Red LED also lights.

The pressure then drops again to -11hPa and both LEDs remain lit.

The pressure change starts decreasing to -10 hPa and again this is still over the extended range so both LEDs remain lit.

Once the pressure change drops to below -10 the Red LED will go out showing extended range is again in use.

 

 

 

 

In Jan 2020 there was a record high reading of 1050hPa is the South of England my main barometer went into the extended range with the pointer on the red 1050 and the red high range LED lit.

 

 

 

 

Startup

On initial power up an LED test is performed.

Once complete the hands will step to their initial settings ready to be calibrated.

 

 

 

 

 

 

Control Switches

 

Barometer/6 hour Controls

Change Setting

This button is only enabled when the "Select Setting Enable" slide switch is On.

Once the "Select Setting Enable" slide switch is On the "Change Setting" switch function is controlled by the "Select Setting" Switch

Turning the "Select Setting" Switch will change the function of the "Change Setting" switch and display the function on the main LCD.

 

Reset to 30 Secs

Pressing this switch at any time will reset the RTC seconds to 30. This is used when setting the RTC in sync to an accurate time source.

 

Select Setting Enable

This slide switch enables the "Change Setting" and  "Select Setting" switches.

It will normally be set to Off.

 

Select Setting

This rotary control will select the function of the "Change Setting" switch.

This variable resistor is on an analogue port of the Arduino which is set to apply settings on a range of resistor values.

The switch has the following settings. The setting selected will be displayed on the main LCD in place of the 6 hour display values.

  1. Barometer Advance - Steps the main barometer hand forwards 1 hPa

  2. Barometer Retard - Steps the main barometer hand backwards 1 hPa

  3. Baro Inch Advance - Steps the main barometer hand forwards by 1 stepper motor unit so the hand can be set precisely on a unit

  4. Baro Inch Retard - Steps the main barometer hand backwards by 1 stepper motor unit so the hand can be set precisely on a unit

  5. 6Hr Baro Advance - steps the 6 hour hand forward by 1 hPa

  6. 6Hr Baro Retard - steps the 6 hour hand backward by 1 hPa

  7. 6Hr Baro Inch Advn - Steps the main 6 hour hand forwards by 1 stepper motor unit so the hand can be set precisely on a unit

  8. 6Hr Baro Inch Retard - Steps the main 6 hour hand backwards by 1 stepper motor unit so the hand can be set precisely on a unit

  9. RTC Min Advance - advances the minute of the RTC

  10. RTC Min Retard - retards the minute of the RTC

  11. RTC Hour Advance  - advances the hour of the RTC

  12. RTC Hour Retard -retards the hour of the RTC

  13. Off - no changes made Note return the control to this position on completion of settings

 

 

 

 

3 hour Controls

3 Hour Step Fwd

Pressing this button at any time will step the 3 hour display forward 0.5hPa

 

3 Hour Step Bwd

Pressing this button at any time will step the 3 hour display backward 0.5hPa

 

Slow Fwd

This button will step the 3 hour display forward by 1 stepper motor unit so the hand can be set precisely on a unit

 

Slow Bwd

This button will step the 3 hour display backward by 1 stepper motor unit so the hand can be set precisely on a unit

 

 

 

Stepper Motors

The barometer uses 3 Nema 17 Stepper Motors 1A, 13N.cm Holding Torque, 4-Lead, 1.8°

I used 1.8° motors as the steps fit exactly into 360° 200 times.

 

 

 

 

 

 

Modules

AMS117

The The AMS1117 series of adjustable and fixed voltage regulators are designed to provide up to1A output current and to operate
down to 1V input-to-output differential. The dropout voltage of the device is guaranteed maximum 1.3V, decreasing at lower load currents.
On-chip trimming adjusts the reference voltage to 1.5%. Current limit is set to minimize the stress under overload conditions on both the regulator and power source circuitry.

The module on this project is 3.3v and is used to power the BMP180 module.

LM2596 Buck DC to DC Converter 3.0-40V to 1.5-35V

This module converts the 12v input to 5v

 

A4988 Stepper Motor Driver

This breakout board for Allegro’s A4988 microstepping bipolar stepper motor driver features adjustable current limiting, over-current and over-temperature protection, and five different microstep resolutions (down to 1/16-step).

It operates from 8 V to 35 V and can deliver up to approximately 1 A per phase without a heat sink or forced air flow (it is rated for 2 A per coil with sufficient additional cooling).

Here are some of the driver’s key features:

Simple step and direction control interface


Five different step resolutions: full-step, half-step, quarter-step, eighth-step, and sixteenth-step


Adjustable current control lets you set the maximum current output with a potentiometer, which lets you use voltages above your stepper motor’s rated voltage to achieve higher step rates


Intelligent chopping control that automatically selects the correct current decay mode (fast decay or slow decay)


Over-temperature thermal shutdown, under-voltage lockout, and crossover-current protection


Short-to-ground and shorted-load protection

 

 

Power connections
The driver requires a logic supply voltage (3 – 5.5 V) to be connected across the VDD and GND pins and a motor supply voltage (8 – 35 V) to be connected across VMOT and GND.

These supplies should have appropriate decoupling capacitors close to the board, and they should be capable of delivering the expected currents (peaks up to 4 A for the motor supply).

Warning: This carrier board uses low-ESR ceramic capacitors, which makes it susceptible to destructive LC voltage spikes, especially when using power leads longer than a few inches.

Under the right conditions, these spikes can exceed the 35 V maximum voltage rating for the A4988 and permanently damage the board, even when the motor supply voltage is as low as 12 V.

One way to protect the driver from such spikes is to put a large (at least 47 µF) electrolytic capacitor across motor power (VMOT) and ground somewhere close to the board.

Motor connections
Four, six, and eight-wire stepper motors can be driven by the A4988 if they are properly connected; a FAQ answer explains the proper wirings in detail.

Warning: Connecting or disconnecting a stepper motor while the driver is powered can destroy the driver. (More generally, rewiring anything while it is powered is asking for trouble.)

Step (and microstep) size
Stepper motors typically have a step size specification (e.g. 1.8° or 200 steps per revolution), which applies to full steps.

A microstepping driver such as the A4988 allows higher resolutions by allowing intermediate step locations, which are achieved by energizing the coils with intermediate current levels.

For instance, driving a motor in quarter-step mode will give the 200-step-per-revolution motor 800 microsteps per revolution by using four different current levels.

The resolution (step size) selector inputs (MS1, MS2, and MS3) enable selection from the five step resolutions according to the table below.

MS1 and MS3 have internal 100kΩ pull-down resistors and MS2 has an internal 50kΩ pull-down resistor, so leaving these three microstep selection pins disconnected results in full-step mode.

For the microstep modes to function correctly, the current limit must be set low enough (see below) so that current limiting gets engaged.

Otherwise, the intermediate current levels will not be correctly maintained, and the motor will skip microsteps.

MS1 MS2 MS3 Microstep Resolution
Low Low Low Full step
High Low Low Half step
Low High Low Quarter step
High High Low Eighth step
High High High Sixteenth step



Control inputs
Each pulse to the STEP input corresponds to one microstep of the stepper motor in the direction selected by the DIR pin.

Note that the STEP and DIR pins are not pulled to any particular voltage internally, so you should not leave either of these pins floating in your application.

If you just want rotation in a single direction, you can tie DIR directly to VCC or GND.

The chip has three different inputs for controlling its many power states: RST, SLP, and EN. For details about these power states, see the datasheet.

Please note that the RST pin is floating; if you are not using the pin, you can connect it to the adjacent SLP pin on the PCB to bring it high and enable the board.

 

 

 

Current LImiting

Before connecting the motor we should adjust the current limiting of the driver so that we are sure that the current is within the current limits of the motor.

We can do that by adjusting the reference voltage using the potentiometer on the module to set the VRef.

See details on the video below.

 

Module Details 

 

 

Stepper Driver fitted with supplied heatsink

 

 

 

 

BMP180 Pressure Sensor Module

The BMP180 Breakout is a barometric pressure sensor with an I2C ("Wire") interface.

Barometric pressure sensors measure the absolute pressure of the air around them.

This pressure varies with both the weather and altitude.

Depending on how you interpret the data, you can monitor changes in the weather, measure altitude, or any other tasks that require an accurate pressure reading.

Connect the +, -, CL, and DA pins to your Arduino. CL goes to SCL and DA goes to SDA.

IMPORTANT: Connect the power pins (+ and -) ONLY to a 3.3V supply. Larger voltages will permanently damage the part.

Note that because I2C uses open drain drivers, it is safe to connect the I2C pins (DA and CL) to an I2C port on a 5V microprocessor.

 

 

 

 

 

RTC 

Modification of DS3231 AT24C32 I2C Precision Real Time Clock Module

This brometer uses a DS3231 AT24C32 I2C Precision Real Time Clock Module.

The module comes supplied with a Lithium-Ion rechargeable battery see diagram above. I use a non rechargeable battery so have removed resistor R5

from the module as below.

 

Location of R5 on the DS3231 module.

 

Charging Resistor R5 removed.

 

 

 

 

 

 

 

 

Construction

The circuit was prototyped using a hardboard dial with holes drilled for the motor spindles and LEDs.

Various dial designs were then printed on normal paper and Sellotaped over the top.

The LED wiring loom was made with the LEDs in position on the temporary dial.

 

 

Location of main boards and motors behind the dial

Wooden mounting blocks are bonded to the dial and the boards are then screwed to the blocks.

The wooded blocks are cut fron a sheet of plywood.

Motors are hot melt glued to wooden mounting blocks. The mounting blocks depths are set to allow the correct protrusion of the spindles through the dial.

These blocks are also hot melt glued to the dial.

 

 

 

 

Rear view showing mounting locations for wooden blocks

 

 

All modules, Vero boards and stepper motors mounted in place

 

 

Stepper motors are mounted using hot melt glue onto wooden blocks.

 

The thickness of the blocks are cut to allow the correct protrusion of the spindle shaft through the dial.

 

 

 

 

 

Picture Frame Version

I have used two identical picture frames mounted back to back. These frames are 30cm x 30cm approx. 12"x12"

 

Frames are joined back to back

 

This gives a double depth frame

 

 

 

Rear side view showing wired boards and modules

 

 

 

 

 

The dial is fixed to the rear frame recess using the original photo frame mount tabs.

 

 

Actual rear half of the frame with all wiring in place

 

 

 

The front of the dial now shows through the front half of the frame.

Wooden bevels hide the space behind the front half of the frame.

 

 

 

 

Schematic

Power

 

Main Circuit

 

Note put a large (at least 47 µF) electrolytic capacitor across the stepper motor driver motor power (VMOT) and ground somewhere close to the board.

See 3 x C5 below.

 

 

 

 

 

Vero Board Layout

Vero Board with all modules removed

 

 

Vero Board with modules in place

 

 

Vero Board rear view (flipped down from top)

 

 

LED Vero Board

This board is used as a connection point for the dial LEDs.

This allows the dial to be disconnected from the main board if required for maintenance.

The LED Vero Board connects to the main board with Dupont sockets and male Dupont cable

 

Vero Board wiring in progress

 

 

 

Boards and modules mounted on wooden blocks fixed to the dial with impact adhesive.

 

 

 

 

 

 

 

 

 

Hand Construction

The 2 small hands for the 3 hour and 6 hour display were purchased from Ebay and were just trimmed to size.

I could not find a large hand for the Barometer to match so I made my own by cannibalizing 3 other hands.

below completed hands

 

 

 

The long barometer hand was constructed from 3 different hands

 

 

To get the lower spade balance part of the hand I used a spade hand.

 

First I cut off the top using sharp scissors

 

The top was then trimmed by cutting the point off

 

The remaining part was then filed away

 

This left the completed balance for the hand

 

 

To make the front pointer and center I cut the end off one off my donor hands

 

 

To make the rear balance shaft I cut a section out of the 3rd donor hand

 

 

below

left pic the 3 parts of the new hand

middle pic shows the overlap of the balance shaft to allow for bonding

right pic shows the balance shaft bonded with impact adhesive to the underside of the balance and center shaft

 

 

below completed long barometer hand next to the 2 smaller 3 hour and 6 hour hands

 

 

 

 

 

 

 

LCD Information Displays

3 Hour

This display shows the 3 hour readings and information on the 3 hour dial.

It also shows the weather forecast based on the current and last 3 hour reading.

6 Hour 

This display shows the main barometer dial readings and also the 6 hour readings.

 

 

 





 

Most analogue barometers just use the air pressure as an indication to predict the weather.

The weather is simply written around the dial and read off from the pointer.

Forecasting is a little bit more complicated that as you have to use the 2nd pointer and make note of any change over a 3 hour period.

You will have to memories the combinations of current pressure and rising/falling pressure to get your forecast.

 

The weather forecast on my barometer uses 8 LEDs.

Using the current air pressure and rate of change over the last 3 hours the weather is predicted on the LEDs.

 

I have visited a number of weather sites and have gathered the following info on predicting the weather with a barometer.

 

 

Predicting the Weather With the Barometer
More specifically, a barometer with readings in hPa can be interpreted in this manner:

If the reading is over 1022 hPa

Rising or steady pressure means continued fair weather.
Slowly falling pressure means fair weather.
Rapidly falling pressure means cloudy and warmer conditions.


If it falls between 1009–1022 hPa

Rising or steady pressure means present conditions will continue.
Slowly falling pressure means little change in the weather.
Rapidly falling pressure means that rain is likely, or snow if it is cold enough.


If the reading is under 1009 hPa

Rising or steady pressure indicates clearing and cooler weather.
Slowly falling pressure indicates rain
Rapidly falling pressure indicates a storm is coming.

 

 

 

 

 

 

Weather Prediction

Arduino Barometer

Using the info above my barometer applies the following logic to predict the weather.

Logic is applied in the sequence below with the resulting LEDs lit.


Air pressure <1009 hPa


Rising or steady pressure indicates clearing and cooler weather

Air Pressure <1009.00 and 3 hour change >= 0






 


Air Pressure <1009 hPa


Slowly falling pressure indicates rain

Air Pressure <1009.00 and 3 hour change  <0  and  3 hour change >= -1.5

 

 

 

 

 

 

 



Air Pressure <1009 hPa


Rapidly falling pressure indicates a storm is coming.

Air Pressure <1009.00 and 3 hour change  <  -1.5




 

 

 



Air Pressure is between 1009 and 1022 hPa


Rising or steady pressure means present conditions will continue.

Slowly falling pressure means little change in the weather.

Air Pressure >= 1009.00 and  Air Pressure <= 1022.00 and 3 hour change >= -1.5 and 3 hour change <= 1.5

 

 

 

 

 


Air Pressure is between 1009 and 1022 hPa

Air Pressure rising rapidly means weather is clearing

Air Pressure >= 1009.00 and Air Pressure <= 1022.00 and  3 hour change > 1.5

 

 





 


Air Pressure is between 1009 and 1022 hPa


Rapidly falling pressure means that rain is likely, or snow if it is cold enough.

Air Pressure >= 1009.00 and  Air Pressure <= 1022.00 and  3 hour change < -1.5



 

 


 

 



Air Pressure over 1022 hPa


Rising or steady pressure means dry weather.

Air Pressure > 1022.00 and  3 hour change >=  0 

 

 

 

 

 



Air Pressure over 1022 hPa


Slowly falling pressure means fair weather.

Air Pressure > 1022.00 and 3 hour change < 0 and  3 hour change >=  -1.5

 

 

 

 

 


Air Pressure over 1022 hPa


Rapidly falling pressure means change

Air Pressure > 1022.00 && 3 hour change <  -1.5

 



 

 

 

Initial Start-up

On initial power up the barometer will need to be setup using the controls on the Vero Board.

 

 

RTC

The RTC will need to be set to the correct time.

I set it to UTC and don't bother changing to summer time.

Before adjusting the time make  note of the "Disp" value in this case -5.

This is the value of the 6 hour hand and will be needed later in the setup.

Slide the "Select Setting Enable" switch to the On position.

The display will not change.

 

 

 

Slowly turn the "Select Setting" Knob clockwise and the 2nd row of the main LCD display will change.

Stop when the display shows "RTC Hour Retard"

If you want to retard the RTC hours press the red "change setting" button.

A single click will step the hours backwards.

Multiple clicks will step back the number of clicks pressed but will take a second to update the RTC.

 

 

 

Turning the  "Select Setting" Knob further will change the display to "RTC Hour Advance"

If you want to advance the RTC hours press the red "change setting" button.

A single click will step the hours forwards.

Multiple clicks will step forward the number of clicks pressed but will take a second to update the RTC.

 

 

 

Turning the  "Select Setting" Knob further will change the display to "RTC Min  Retard"

If you want to retard the RTC mins press the red "change setting" button.

A single click will step the mins backwards.

Multiple clicks will step back the number of clicks pressed but will take a second to update the RTC.

 

 

 

Turning the  "Select Setting" Knob further will change the display to "RTC Min  Advance"

If you want to advance the RTC mins press the red "change setting" button.

A single click will step the mins forwards.

Multiple clicks will step forwards the number of clicks pressed but will take a second to update the RTC.

 

 

 

Once you have completed the RTC setting or any other setting return the "Select Setting" Knob fully anti clockwise until the display shows "Off"

Slide the "Select Setting Enable" switch to the Off position.

Note. The seconds can be synchronized to 30 seconds at any time by pressing the black "Reset to 30 seconds" button.

The time will now be remembered on the RTC if the power is turned off.

 

 

 

 

Setting the 6 hour hand

Once the RTC is set the barometer and 6 hour air pressure hands need to be set.

Slide the "Select Setting Enable" switch to the On position.

The display will not change.

Slowly turn the "Select Setting" Knob clockwise until "6Hr Baro Inch Retard" is displayed.

On very first power up the 6 hour hand will need calibrating to the nearest digit.

If the nearest digit is behind the hand  press the red "change setting" button.

A single click will inch the hand backwards step by step. Holding the button will inch the hand backward repeatedly.

Once the hand is exactly on a digit release the button.

 

If the nearest digit in front of the hand or if you have inch retarded the hand using the above too much turn the "Select Setting" Knob clockwise until "6Hr Baro Inch Advn" is displayed.

Press the red "change setting" button.

A single click will inch the hand forwards step by step. Holding the button will inch the hand forward repeatedly.

Once the hand is exactly on a digit release the button.

 

 

 

Once the 6 hour hand has been set exactly on a digit the hour hand need to be set to the correct value.

Before adjusting the RTC you made a note of this number -5

 

 

 

If the 6 hour display hand is too advanced.

Turn the "Select Setting" Knob clockwise until "6Hr Baro Retard" is displayed.

Press and release the red "change setting" button.

This sill step the 6 hour hand backward 1 whole unit. Stop when the 6 hour hand reaches your noted number.

 

 

 

If the 6 hour display hand is retarded.

Turn the "Select Setting" Knob clockwise until "6Hr Baro Advance" is displayed.

Press and release the red "change setting" button.

This sill step the 6 hour hand forward 1 whole unit. Stop when the 6 hour hand reaches your noted number.

 

 

 

Note the 6 hour display will take 8 hours to display correctly as it will need to store readings in memory over that period of time.

You can always add the previous air pressure readings into the code before loading is you require the 6 hour display to function from startup.

The code converts the hours to a H number as displayed above H = 6.

In the code line 128 H6 will mean put the current hour reading under hour6

the previous reading in hour7

the reading before that in hour0 etc

int hour0 = 1015;
int hour1 = 1016;
int hour2 = 1015;
int hour3 = 1016;
int hour4 = 1016;
int hour5 = 1016;
int hour6 = 1012;
int hour7 = 1013;

Here are the live last days hourly barometer readings from Kenley. You should be able to get your local readings off the internet.

 

 

 

 

Setting the main barometer hand

Now the 6 hour display is correct the main barometer hand will need to be set to the rounded sea level pressure on the 3rd row down on the main LCD.

On very first power up the main barometer hand will need calibrating to the nearest digit.

Turn the "Select Setting" Knob clockwise until "Baro Inch Retard" is displayed.

If the nearest digit is behind the hand  press the red "change setting" button.

A single click will inch the hand backwards step by step. Holding the button will inch the hand backward repeatedly.

Once the hand is exactly on a digit release the button.

 

 

 

If the nearest digit in front of the hand or if you have inch retarded the hand using the above too much turn the "Select Setting" Knob clockwise until "Baro Inch Advn" is displayed.

Press the red "change setting" button.

A single click will inch the hand forwards step by step. Holding the button will inch the hand forward repeatedly.

Once the hand is exactly on a digit release the button.

 

 

 

If the main barometer hand is too advanced.

Turn the "Select Setting" Knob clockwise until "Barometer Retard" is displayed.

Press and release the red "change setting" button.

This will step the main barometer hand backward 1 whole unit. Stop when the hour hand reaches your indicated rounded sea level pressure.

 

 

 

If the main barometer hand is retarded compared to the your indicated rounded sea level pressure .

Turn the "Select Setting" Knob clockwise until "Barometer Advance" is displayed.

Press and release the red "change setting" button.

This will step the main barometer hand forward 1 whole unit. Stop when the hand reaches your indicated rounded sea level pressure.

 

 

 

 

 

Setting the 3 hour hand.

Adjustment of the 3 hour hand is by the four buttons Green, White, Blue and Yellow on the Vero board.

On initial power up the the 3 hour hand will need to be calibrated to the nearest unit or half unit.

If the 3 hour hand nearest unit value is in advance of the 3 hour hand press the Yellow "Slow Bwd" button to inch the hand backwards. Keeping the button pressed will repeatedly inch the hand backwards.

If the 3 hour hand nearest unit value is behind the 3 hour hand press the Blue "Slow Fwd" button to inch the hand forwards. Keeping the button pressed will repeatedly inch the hand forwards.

Once the 3 hour hand is exactly on a unit/half unit the hand can be set to the value "D" on the 3 hour LCD display.

If in the hand is in advance of the value "D" press the White "3Hr Step Bwd" button to step the 3 hour hand in half units backwards.

If in the hand is in less than  the value "D" press the Green "3Hr Step Fwd" button to step the 3 hour hand in half units forwards.

Note the 3 hour display will take 4 hours to display correctly as it will need to store readings in memory over that period of time.

You can always add the previous air pressure readings  into the code before loading is you require the forecast and 3 hour display to function from startup.

3 hour display code at line 124

float hour0 is current hour

float hour1 is previous hour etc etc

float hour0 = 1036.00;
float hour1 = 1036.00;
float hour2 = 1036.00;
float hour3 = 1036.00;
float hour4 = 1036.00;

Here are the live last days hourly barometer readings from Kenley. You should be able to get your local readings off the internet.