Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pcfens/rpi-as3935-web
A web server that displays output from an AS3935 connected to a RaspberryPi in real time.
https://github.com/pcfens/rpi-as3935-web
Last synced: about 1 month ago
JSON representation
A web server that displays output from an AS3935 connected to a RaspberryPi in real time.
- Host: GitHub
- URL: https://github.com/pcfens/rpi-as3935-web
- Owner: pcfens
- Created: 2014-12-17T21:55:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-07T02:35:35.000Z (over 8 years ago)
- Last Synced: 2024-10-26T22:16:02.106Z (3 months ago)
- Language: HTML
- Size: 43.9 KB
- Stars: 11
- Watchers: 6
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
RPi-AS3935-Web
==============A simple webpage designed to display information read from the
[AMS Franklin Lightning Sensor](http://www.ams.com/eng/Products/RF-Products/Lightning-Sensor/AS3935).The website makes use of the [RaspberryPi-AS3935 library](https://github.com/pcfens/RaspberryPi-AS3935).
## Getting Started
### Connecting the AS3935
In my test setup I connected my breakout board to the Pi as shown
| AS3935 Pin | Raspberry Pi Pin |
| ---------: | :--------------- |
| 4 (GND) | 25 (Ground) |
| 5 (VDD) | 1 (3v3 Power) |
| 10 (IRQ) | 11 (GPIO 17) |
| 11 (I2CL) | 5 (SCL) |
| 13 (I2CD) | 3 (SDA) |### Kernel Modules
To run this webserver you'll need to have the correct kernel modules loaded. Adafruit has a nice
[tutorial](http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c)
set up, though depending on the breakout board that you use, you may
not see anything show up when you run `i2cdetect`.### Python libraries
To directly access the hardware, you'll need to install the `python-smbus` package available in
the repositories on Raspbian.Other dependencies can be installed using `sudo pip install -r requirements.txt`. `sudo` is required
unless you use a virtualenv and write udev rules so that the I2C bus is accessible by an
unprivilged user.### Configuring the Server
Copy the `settings.cfg.sample` file to `settings.cfg` and edit the appropriate
portions to match your setup. Each setting has comments to help.## Running the Server
After everything is done, you can start the server by running `sudo python lightning_web.py`. If
everything starts without any errors, you can visit `http://pi_address:port/` to interact
with the sensor (the default port is 5000).An upstart/systemd job to start the server on boot will likely come later - we're just not there
yet (feel free to submit a PR).### Scaling
Running the server this way does not scale well beyond a few connections. If you need to
support more users, I'd suggest looking in to gunicorn, and possibly nginx (configuration
information at https://flask-socketio.readthedocs.org/en/latest/).I've tested running the site with gunicorn using the command
```
sudo gunicorn \
--worker-class socketio.sgunicorn.GeventSocketIOWorker \
--bind :5000 \
lightning_web:app \
--log-file -
```
Just ignore the exception it throws early on for now (it appears to be a bug in gunicorn).If you still have scaling issues (how many people care about lightning at your house anyway?),
then things need to be re-designed. At this point you should probably be pushing the data
to real server(s) that can re-distribute it as needed.