Skip to content

A complete website to manage your RPi HQ camera. Take pictures, videos or timelapses.

License

Notifications You must be signed in to change notification settings

Bilou4/hubble-berry

Repository files navigation

Hubble-Berry

I wanted to start Astrophotography and the HQ pi camera had just been marketed. Thus, I decided to create a website to manage this camera easily and let others access some pages as a Gallery. Hubble-Berry is my first contribution to the Open Source world, so do not hesitate to suggest any improvements on the code, the documentation or features.


Here is an example of a photo taken thanks to Hubble-Berry. More examples in ./appFolder/static/camera


Getting Started

These instructions will get you a copy of the project up and running on your local machine (Raspberry Pi). For development and testing purposes, see commandLine_development.md. If you have any question, please feel free to ask by creating a new issue.


Prerequisites

Here is what I used to make this project:

  • Raspberry PI model 3B [1]
  • Raspberry PI HQ Camera [2]
  • RaspAp [3]: to create an access point
  • Activate the camera module (required) and SSH (optionnal but it's easier to control) on your Raspberry PI
  • USB key named 'HUBBLE_SAVE' and with the following organization (only if you want to save your files on a USB key. You can also use ./scripts/download.py to download from another computer.):
.
├── camera
│   ├── pictures
│   ├── timelapse
│   ├── video

working_diagram



Deployment on your Raspberry pi

To set up a development environment, see the commandLine_development.md file.

First installation

Clone the repository.

git clone https://github.com/Bilou4/hubble-berry.git
cd hubble-berry

Initiate a virtual environment.

pip3 install virtualenv
virtualenv --python=/usr/local/bin/python3.7 hubble-berry-project # your python version must be greater than 3.6
. activate
./installation.sh
pip3 install picamera # not in installation.sh because it would not work on another computer than Raspberry Pi.

Set environment variable.

echo "export FLASK_APP=/path/to/hubble-berry/main.py" >> ~/.bashrc
source ~/.bashrc
. activate
flask --help # shows available commands
flask translate compile # To compile the language translations

The gunicorn package is a production web server for Python applications. The supervisor service is useful in ensuring the application is always up.

sudo apt-get install supervisor
pip3 install gunicorn

If everything went well, you can try by manually starting the server.

gunicorn -b :8000 -w 3 --threads 1 --timeout 86400 appFolder:app

Change the Supervisor configuration file : /etc/supervisor/conf.d/hubble-berry.conf

[program:hubble-berry]
command=/path/to/hubble-berry/hubble-berry-project/bin/gunicorn -b :8000 -w 3 --threads 1 --timeout 86400 appFolder:app
directory=/path/to/hubble-berry
user=pi
stdout_logfile=/path/to/hubble-berry/supervisor_stdout.log
stderr_logfile=/path/to/hubble-berry/supervisor_stderr.log
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true

After you write this configuration file, you have to reload the supervisor service for it to be imported:

sudo supervisorctl reload

And just like that, the gunicorn web server should be up and running and monitored!

You have the possibility to watch logs:

tail -f /path/to/hubble-berry/supervisor_stderr.log # or supervisor_stdout.log

If everything worked properly, you should be able to reach the first page.

First_page

There are 2 default users (username/password):

  1. admin/admin
  2. user/user

Upgrade

Doing an upgrade is in general more complicated than just restarting the server. You may need to apply database migrations, or compile new language translations, so in reality, the process to perform an upgrade involves a sequence of commands:

git pull                              # download the new version
sudo supervisorctl stop hubble-berry  # stop the current server
flask db upgrade                      # upgrade the database
flask translate compile               # upgrade the translations
sudo supervisorctl start hubble-berry # start a new server

Built With

Flask - The web framework used
picamera - A pure Python interface to the Raspberry Pi camera module 

Contributing

Please read CONTRIBUTING.md for details on the process to submit us pull requests.


Authors

Bilou4 - Initial work

TODO List

Task name Description
Exposure time timelapse Allow the user to anticipate a longer exposure time after a certain runtime (or number of photos - maybe easier)

License

This project is licensed under the GPL License - see the COPYING file for details


Acknowledgments


References

[1] https://www.raspberrypi.org/products/raspberry-pi-3-model-b/

[2] https://www.raspberrypi.org/products/raspberry-pi-high-quality-camera/

[3] https://github.com/billz/raspap-webgui

About

A complete website to manage your RPi HQ camera. Take pictures, videos or timelapses.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published