Skip to content

Commit

Permalink
Update: RPi documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DM6JM committed Mar 12, 2023
1 parent 32e26d5 commit f6d9cd6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tools/rpi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ Required Hardware Setup

`ahoy.py` has been successfully tested with the following setup

- RaspberryPi Model 2B (any model should work)
- RaspberryPi Model 2B, 4B (any model should work)
- NRF24L01+ Radio Module connected as described, e.g., in [2]
(Instructions at [3] should work identically, but [2] has more
pretty pictures.)
- or the [PaHoy board](https://github.com/DM6JM/PaHoy/)
- TMRh20's 'Optimized High Speed nRF24L01+ Driver' [3], installed
as per the instructions given in [4]
- Python Library Wrapper, as per [5]
- or the easy way, using [pyRF24](https://github.com/nRF24/pyRF24)[6]

How to talk to the nRF24L01+ in Python?
---------------------------------------
Either you make use of the way proposed in the following, using the NRF24 Python Wrapper and the 'Optimized High Speed nRF24L01+ Driver' OR you just use pip and let it install pyRF24.

- If you go with pyRF24, all that needs to be done is installing pyRF24 as described in [6]. Please be aware that not all examples provided in this repo are prepared to use pyRF24. It might be nescessary to adjust the imports from RF24 to pyRF24 to get them running. Once you installed pyRF24, go on at 'Required python modules'
- If you go with the RF24 wrapper, do the following steps

Building the NRF24 Python Wrapper
---------------------------------
Expand Down Expand Up @@ -220,7 +228,12 @@ Example injects exactly the same as we normally use to poll data

This allows for even faster hacking during runtime


Running it as a service
-----------------------
If you want to run directly from the start, you might want to install it as a service.
Depending on if you want to run it once a user is logged in or as soon as the system is booted, two service examples are included.
ahoy.service allows you to start it as a user service upon login.
ahoy_system.service allows you to start it as a system service already before login without user interaction.

Analysing the Logs
------------------
Expand Down Expand Up @@ -263,3 +276,4 @@ References
- [3] https://nrf24.github.io/RF24/index.html
- [4] https://nrf24.github.io/RF24/md_docs_linux_install.html
- [5] https://nrf24.github.io/RF24/md_docs_python_wrapper.html
- [6] https://github.com/nRF24/pyRF24
42 changes: 42 additions & 0 deletions tools/rpi/ahoy_system.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
######################################################################
# systemd.service configuration for ahoy (lumapu)
# users can modify the lines:
# Description
# ExecStart (example: name of config file)
# WorkingDirectory (absolute path to your private ahoy dir)
# To change other config parameter, please consult systemd documentation
#
# To activate this service, enable and start ahoy.service:
# - Create folder ahoy in /home/ and set owner to the user that the
# service should be executed for (e.g. pi)
# - Copy folder contents to new folder
# - Adjust the user that this service should be executed as, avoid root
# - Execute commands to setup, check and start/stop as wanted
# $ sudo systemctl enable /home/ahoy/tools/rpi/ahoy.service
# $ sudo systemctl status ahoy
# $ sudo systemctl start ahoy
# $ sudo systemctl stop ahoy
#
# 2023.01 <PaeserBastelstube>
# 2023.03 <DM6JM>
######################################################################

[Unit]

Description=ahoy (lumapu) as Service
After=network.target local-fs.target time-sync.target

[Service]
ExecStart=/usr/bin/env python3 -um hoymiles --log-transactions --verbose --config ahoy.yml
RestartSec=10
Restart=on-failure
Type=simple
User=pi

# WorkingDirectory must be an absolute path - not relative path
WorkingDirectory=/home/ahoy/tools/rpi
EnvironmentFile=/etc/environment

[Install]
WantedBy=default.target

0 comments on commit f6d9cd6

Please sign in to comment.