Skip to content

A 3D printed lighthouse weather station with a Raspberry Pi controlled by a Flutter mobile application

Notifications You must be signed in to change notification settings

Mimi94Mimi/lighthouse-weather-station

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lighthouse Weather Station

The device informs about the weather with a color set. It also provides ways to change the location or the lighthouse's color from a smartphone using Bluetooth Low Energy.

You can find all the necessary files in these packages:

  • app/lighthouse_weather: a Flutter mobile app
  • station: a Python service for RPi
  • print: the 3D print files
  • media: photos and screenshots

⚠️ This project has been migrated to support Bluetooth Low Energy
See Using Bluetooth Low Energy between Raspberry Pi and Flutter
Checkout the branch feature_classic_bluetooth to use Classic Bluetooth protocol on RFCOMM.


Read How I built a lighthouse weather station? to see how this was created.

Installation


⚠️ Make sure your RPi uses Python3 and pip3 (see the Adafruit guide).


RPi installation

On RPi ZW, we need to install the following dependencies:

$ sudo apt install python3-dbus
$ sudo pip3 install Adafruit-Blinka
$ sudo pip3 install adafruit-circuitpython-neopixel

Enable the "experimental" flag to bluetooth deamon in bluez:

$ sudo nano /etc/systemd/system/dbus-org.bluez.service

Add -E flag at the end of line:

ExecStart=/usr/lib/bluetooth/bluetoothd -E

Then, restart the Pi as follows:

$ sudo reboot

Mobile app configuration

On the Pi, by using echo -e 'show\nquit' | sudo bluetoothctl, you will get the following output:

Controller XX:XX:XX:XX:XX:XX (public)
	Name: raspberrypi
	Alias: LighthouseWeatherStation
	...

Copy-paste the MAC address XX:XX:XX:XX:XX:XX into the mobile app, in /lib/bloc/bluetooth/bluetooth_bloc.dart:

final String _nameLighthouseStation = 'LighthouseWeatherStation';
final String _addressLighthouseStation = 'XX:XX:XX:XX:XX:XX';

Python service configuration

Go to OpenWeatherMap and get an api key.
You have to copy-paste it in the Python script instead of xxx:

appid = 'appid=xxx'

Start the Lighthouse Weather Station

$ sudo python3 main.py

This should output:

GATT application running
GATT application registered
GATT advertisement registered
---
Update weather
Request response: 18°C (weather: 803)
Color selected: (255, 255, 0)
...

Then, when a device is connected, the output should add Sending line:

Update weather
Request response: 18°C (weather: 803)
Color selected: (255, 255, 0)
Sending:  D=19,W=803,C=6454880
...

Media

When the device is off:

When set a custom color (white for example):

About

A 3D printed lighthouse weather station with a Raspberry Pi controlled by a Flutter mobile application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 55.0%
  • Python 44.1%
  • Other 0.9%