Close

Vibration alerts!

A project log for Weather Radar!

NWS radar images & weather data, in a retro analog meter case!

thornhillThornhill! 06/10/2021 at 04:340 Comments

Howdy folks!

Now that we're entering the stormy part of the year, I thought it was about time the Weather Radar had the ability to capture my attention when severe weather was heading my way (other than all the colourful alerts that flash across the display).

I decided on adding a pancake-style vibration motor because 1) it's less grating than a tone alarm, 2) it would completely validate my spontaneous purchase of a pancake-style vibration motor a few weeks prior.

Hardware

To drive the motor I'm using a DRV2605L Haptic Motor Controller breakout from Adafruit, which comes with several inbuilt vibration effects as well as a CircuitPython library which makes this 178% easier. It uses I2C, so I chained it to the other I2C boards I'm using.

The vibration motor is a slightly beefy one I got from Electronic Goldmine (although it's no longer in stock!) and can be driven from 3 - 6 volts. 

Looking inside the Weather Radar to reveal its electronics. White text and arrows point out the newly added DRV2605L vibration motor driver (blue PCB), and the round pancake vibration motor (circular disk, stuck using double-sided tape to the lower lefthand side of the case).

Code

Thanks to Adafruit's DRV2605L product tutorial, the code is pretty simple!

After initialising the board and the DRV2605 chip, I created a vibrate function (so I could define different vibration sequences in the future). 

My "alert" sequence uses several of the inbuilt effects, starting with a ramping up transition (effect #113) so I don't startle myself or my partner when the 750ms & 1000ms alerts kick in (effects #15, #16). 

import board
import adafruit_drv2605

i2c = board.I2C()
drv = adafruit_drv2605.DRV2605(i2c)
drv.library = 3 #TS2200_library_C
def
vibrate(vibration_sequence): """Play a vibration sequence."""
if vibration_sequence in [0,"0","alert"]: drv.sequence[0] = adafruit_drv2605.Effect(113) drv.sequence[1] = adafruit_drv2605.Effect(119) drv.sequence[2] = adafruit_drv2605.Pause(1) drv.sequence[3] = adafruit_drv2605.Effect(15) drv.sequence[4] = adafruit_drv2605.Pause(1) drv.sequence[5] = adafruit_drv2605.Effect(16) else: pass drv.play()

In my main loop, the Weather Radar checks for local weather warnings every 5-10 mins (depending on weather conditions) and makes a list of them.

If the list is populated (because of a severe thunderstorm or tornado watch/warning) the alert vibration sequence runs.

### Get local warnings and alerts
local_warnings, local_alerts = get_all_alerts(coordinates=(lat_long[1],lat_long[0]))

### If there's any local warnings (severe weather)
### run the alert sequence
if len(local_warnings) > 0:
    vibrate("alert")
else:
    pass

Here's an example of it and the visual alerts in use, letting me know of a severe thunderstorm warning over a part of Montana (after setting the local coordinates for that area).

Going Further

With so many vibration effects, I might experiment and add some subtle haptic feedback, especially when using the navigation switch. 

Discussions