Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0652a7e
add wpa2 config to hostapd.conf dry coded, needs testing on Pi
jscheidtmann Apr 6, 2025
e180a56
fixed type checking
jscheidtmann Apr 6, 2025
c68b94c
Only work, if SSID with CHANGEME detected.
jscheidtmann Apr 6, 2025
442e207
Log if change is needed.
jscheidtmann Apr 6, 2025
ba126fd
Test Testing for CHANGEME
jscheidtmann Apr 6, 2025
934f38f
Getting past action_needed test
jscheidtmann Apr 6, 2025
1b54a76
Should be first working version
jscheidtmann Apr 6, 2025
3349bb6
Better logging of changes performed
jscheidtmann Apr 6, 2025
28b4718
Add "WiFi Password" menu entry, display static text
jscheidtmann Apr 6, 2025
e795edd
UIWiFiPassword: Fixed display
jscheidtmann Apr 6, 2025
a0d9d68
Working password display (display the password literally)
jscheidtmann Apr 8, 2025
904feca
Prepare for displaying QR
jscheidtmann Apr 8, 2025
dc4571c
WiFi QR code is generated.
jscheidtmann Apr 8, 2025
3ebc973
Scaled WiFi code in black/white
jscheidtmann Apr 9, 2025
fcfdadf
More sensible test password
jscheidtmann Apr 9, 2025
f319282
Fix _generate_wifi_code to use right parameters at right places.
jscheidtmann Apr 9, 2025
d0f1895
More space for QR, if long SSID.
jscheidtmann Apr 9, 2025
1959f7b
renamed display_mode to wifi_display_mode to pass type checking
jscheidtmann Apr 9, 2025
0ccea4a
nox/ruff code formatting.
jscheidtmann Apr 9, 2025
57a186d
type stubs for qrcode added.
jscheidtmann Apr 9, 2025
8380087
added context menu. Switching to wifi mode does not work yet.
jscheidtmann Apr 11, 2025
a210d12
QR display for unencrypted AP + show connect SSID for client mode.
jscheidtmann Apr 11, 2025
a6d9397
Provide short cut from quick menu to switch wifi mode.
jscheidtmann Apr 12, 2025
8af9738
code formatted
jscheidtmann Apr 12, 2025
23cee93
Fix nox type_hint error messages.
jscheidtmann Apr 12, 2025
98deae9
Move WiFi Password to "Start" and rename to "Connect WiFi"
jscheidtmann Apr 14, 2025
d455425
Add check list for observation sessions
jscheidtmann Apr 14, 2025
6a858f8
Update user_guide for WiFi connection infos and name of AP
jscheidtmann Apr 14, 2025
70c9525
Context help for "connect WiFi"
jscheidtmann Apr 15, 2025
044a173
Save changes to help screens
jscheidtmann Apr 15, 2025
4bf43b5
Split change of SSID and encryption.
jscheidtmann Apr 15, 2025
12e8469
Merge branch 'main' into secure-wifi
jscheidtmann Apr 15, 2025
6cc710e
Silence type_hints
jscheidtmann Apr 15, 2025
19d0906
Info in how to startup an open Access Point.
jscheidtmann Apr 17, 2025
a4d310c
Server: Added enryption checkbox to Network Settings
jscheidtmann Apr 20, 2025
0b6a305
Change set_ap_pwd() to enable enryption, if necessary.
jscheidtmann Apr 20, 2025
ff5b45f
Ignore that IMU is absent.
jscheidtmann Apr 20, 2025
babaee2
Revert last commit
jscheidtmann Apr 20, 2025
ea157e5
Revert imu commit
jscheidtmann Apr 20, 2025
bbbd764
Log that configure_accesspoint is reached
jscheidtmann Apr 20, 2025
ba4ed4a
Use root logger.
jscheidtmann Apr 20, 2025
9a82dd3
Which version of sys_utils is loaded?
jscheidtmann Apr 20, 2025
d97867e
really configure the AP
jscheidtmann Apr 20, 2025
2173ddd
Fix typo
jscheidtmann Apr 20, 2025
af792da
exec configure_accesspoint when unit is invoked.
jscheidtmann Apr 20, 2025
62fed38
Fix logic in configure_accesspoint
jscheidtmann Apr 20, 2025
2d7cb8f
Further fix login
jscheidtmann Apr 20, 2025
1940b70
Fix encryption needed detection
jscheidtmann Apr 20, 2025
a71da2b
Remove print
jscheidtmann Apr 20, 2025
7e8331e
Only enable encryption after password check
jscheidtmann Apr 20, 2025
8766845
Port 8080 instead of 8181
jscheidtmann Apr 20, 2025
9a0c33c
Use SysUtils logger
jscheidtmann Apr 20, 2025
12b8121
Add CHANGEME to AP Name
jscheidtmann Apr 20, 2025
b081aa2
Add CHANGEME to AP Name
jscheidtmann Apr 20, 2025
c82266f
Use pifinder_dir for wifi_status.txt
jscheidtmann Apr 20, 2025
1d079aa
When enabling encryption from web interface, do not restart hostapd i…
jscheidtmann Apr 20, 2025
dfdfacc
Extract enable_encryption, fix logic to set password
jscheidtmann Apr 20, 2025
b12557c
Merge branch 'main' into secure-wifi
jscheidtmann Apr 27, 2025
3025fb9
Solver: Relax fov condition for solving for testing purposes.
jscheidtmann Apr 27, 2025
2d90ed3
Merge branch 'main' into secure-wifi
jscheidtmann May 5, 2025
b75e62a
Merge branch 'main' into secure-wifi
jscheidtmann May 5, 2025
40e3d94
I18N for wifi_password
jscheidtmann May 5, 2025
1afaf1e
solver: revert 3025fb9
jscheidtmann May 5, 2025
70c8630
Make type cheicking work.
jscheidtmann May 5, 2025
3e368bc
Source code formatting
jscheidtmann May 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion docs/source/build_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,37 @@ After you have all the pins soldrerd, it's a good time to insert the SD card and

.. image:: images/build_guide/ui_module_18.jpeg

There you go! The PiFinder hat is fully assembled and you can move on to printing your parts or :ref:`final assembly<build_guide:assembly>`
There you go! The PiFinder hat is fully assembled and you can move on to configuring the software, to :ref:`printing your parts<build_guide:Configurations Overview>` or :ref:`user_guide: final assembly<build_guide:assembly>`

Test & Software Setup
=========================

Now is the right time to provide power to the Pi and check if everything is alright and configure PiFinder's Access Point and WiFi networks you want to connect to. Note that you can do this also after the assembly, but it is easier and safer to do it now, when all ports of the Raspberry Pi are accessible (in case something goes wrong and you're not able to connect to the PiFinder) and it is easier to exchange a LED, if necessary.

.. note::
Set the PiFinder on the desk and leave it sitting there, until the menu displays. The motion detector (IMU) needs to calibrate itself and it is not able to do so if you move it around. If you hold it in your hand, then the next test may fail.

If the PiFinder is powered up, the screen should display the main menu. If it does not, please check the soldering of the components and the connections to the Raspberry Pi. You may have to reflow the solder joints.

Once the menu displays correctly, move to Tools > Status. This displays the current status of the PiFinder. You should see the following:

.. image:: images/build_guide/status.png
:target: images/build_guide/status.png
:alt: Status of PiFinder on first power up.

The IMU displays "static" or "moving" and the GPS displays 0/0 or N/0 where N is a small number.

WiFi configurations
-----------------------

Now insert a network cable into the Raspberry Pi and connect it to your router. The PiFinder will use DHCP to configure its network. Then use an internet browser on your regular computer and enter ``pifinder.local`` in the address bar. This opens up the PiFinder web interface. If this does not work, you can also try to enter the IP address of the Raspberry Pi (you can find it in your router).

.. warning::
If you do not attach a network cable now, you have to do the configuration later on. If you access the PiFinder in its default configuration, any passwords you enter will be transferred in clear over the air.

Now using the web interface, configure your PiFinder's Access Point and add any additional WiFis that the PiFinder is going to connect to. This is described at :ref:`user_guide:WiFi`. Note that the default password is ``solveit``. As part of the configuration, your PiFinder will reboot.

Once you have configured the Access Point and WiFi networks, you can display the network's QR code in "Start" > "Connect WiFi", now scan the code with your phone or tablet to connect to the PiFinder's Access Point. Open up a browser and enter ``pifinder.local`` in the address bar. This opens up the PiFinder web interface. If this works, congrats! You have successfully configured PiFinder's Access Point and WiFis!

Configurations Overview
========================
Expand Down
15 changes: 15 additions & 0 deletions docs/source/quick_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,21 @@ be in your eyepiece!
The numbers displayed will shift a bit and become brighter indicating a 100% reliable position.


Checklist: Observation Session
-------------------------------------

These are the things, you need to do to start an observation session with the PiFinder:

- Ensure the PiFinder is securely mounted and perpendicular to the ground
- Check that the internal battery is charged or an external power source is connected
- Make sure the lens cap is off
- Verify the PiFinder has a clear view of the sky and is focused. Use "Start" > "Focus" to check the focus
- Put a bright star star at the center of your eyepiece and align PiFinder to it, using "Start" > "Align"
- Confirm you have a GPS lock and local time or select your observation location from your list of saved locations, using "Start" > "Location&Time"
- Optionally connect your smartphone or tablet to the PiFinder (WiFi) network and use the webserver to control it.
- Optionally startup SkySafari and send targets to the PiFinder


Shutting down the PiFinder
---------------------------

Expand Down
48 changes: 37 additions & 11 deletions docs/source/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -508,17 +508,23 @@ wireless access point for other devices to connect to via the Access Point (AP)
:ref:`user_guide:Web Interface` or the :ref:`user_guide:status screen` to switch between these two modes
and to see which mode is currently active.

Using the PiFinder in Access Point mode creates a network called PiFinderAP with no password to allow
easy connection of phones, tablets and other devices in the field.
Using the PiFinder in Access Point mode creates a network called PiFinder-12345, where 12345 will be 5 random characters,
that are determined at first startup of the PiFinder (this avoids collisions on star parties).
Open the "Start" > "Connect WiFi" menu on the PiFinder, this displays a QR code, that you can use to connect to the
PiFinder's network. This network will be encrypted using WPA2. Using **SQUARE** button, you can switch to
display the AP name and password. You can also use the Quick Menu to switch the display or switch the WiFi Mode.

To use the Client mode, you'll need to add information about the WiFi network you'd like the
PiFinder to connect to using the Web Interface as described in :ref:`user_guide:connecting to a new wifi network`

In order to configure the WiFi's name, password and encryption, you can use the PiFinder's web interface,
see :ref:`user_guide:Web Interface` for more details.

PiFinder address
-----------------

In most cases, you can use the name ``pifinder.local`` to connect to the PiFinder. On older computers
or those that don't support zeroconf networking, you can use the IP address provides on the :ref:`Global
Once you are connected to the same WiFi, in most cases, you can use the name ``pifinder.local`` to connect to the PiFinder. On older computers
or those that don't support zeroconf networking, you can use the IP address provided on the :ref:`Global
Options<user_guide:settings menu>` screen to connect. You can connect to the PiFinder via:


Expand All @@ -538,12 +544,13 @@ The PiFinder provides an easy to use web interface which allows you to:
* Backup and restore your observing logs, settings and other data
* View and download your logged observations

To access the web interface for the first time, make sure the PiFinder is in Access Point mode (see :ref:`user_guide:settings menu`). This is the default for new PiFinders to make first time set up easier. Using a phone, tablet or computer, connect to the PiFinder's wireless network called PiFinderAP. It's an open network with no password required. Once connected, open your web browser and visit:
``http://pifinder.local``
To access the web interface for the first time, make sure the PiFinder is in Access Point mode (see :ref:`user_guide:settings menu`).
This is the default for new PiFinders to make first time set up easier. Use the "Start" > "Connect WiFi" display, to connect your phone or tablet.
Once connected, open your web browser and visit: ``http://pifinder.local``


.. note::
If you are connected to the PiFinderAP network and can't load the PiFinder web interface using
If you are connected to the PiFinder-12345 network and can't load the PiFinder web interface using
http://pifinder.local try http://10.10.10.1 as some systems may not support the network features
required to resolve local computer names

Expand All @@ -565,12 +572,12 @@ the Tools option in the web interface.
Connecting to a new WiFi network
---------------------------------

The default behavior of the PiFinder is to generate it's own WiFi network call ``PiFinderAP`` that you can connect to
The default behavior of the PiFinder is to generate it's own WiFi network call ``PiFinder-12345`` that you can connect to
and configure additional networks. To get the PiFinder to connect to an existing WiFi network with Internet access you
can follow the steps below:

1) Make sure the PiFinder is in Access Point mode
2) Connect your phone, tablet, or computer to the PiFinder's wifi network called PiFinderAP
2) Connect your phone, tablet, or computer to the PiFinder's wifi network called similar to PiFinder-12345, see "Start" > "Connect WiFi" for connection infos.
3) Visit http://pifinder.local using your web browser
4) Click the 'Network' link in the top bar, or if you have a smaller screen, click the three stacked horizontal lines in the upper-right corner to access the menu and choose 'Network' from there.
.. image:: images/user_guide/pf_web_net0.png
Expand All @@ -586,6 +593,22 @@ can follow the steps below:
To add more WiFi networks for the PiFinder to look for, navigate to the Network Setup page of the :ref:`user_guide:web interface` and click the + button near the list of WiFi networks and repeat the steps above.


Reset Access Point
--------------------------------------

.. stop::
Only do this if you're not able to connect to the PiFinder's access point using the QR code from "Start" > "Connect WiFi", or you can't display it.

If you can't connect to the PiFinder's access point using the QR code from "Start" > "Connect WiFi", or this doesn't display, you can login into the PiFinder using SSH, if you have a network cable connected. If this does not work, you can plug-in a monitor cable and a keyboard and directly login to the Raspberry Pi. The default username and password are ``pifinder`` and ``solveit``. You may have to open up the PiFinder to have access to the mentioned ports.

1. Login into PiFinder as described above. You should be in the home directory. Check with ``pwd``, it should display ``/home/pifinder``. If not, execute ``cd``.
2. Copy over the default configuration file for hostapd into it's default location: ``sudo cp pi_config_files/hostapd-open.conf /etc/hostapd/hostapd.conf``.
3. Then check, if PiFinder is in "Client" or "Access Point" mode. Execute ``cat wifi_status.txt``. This should display either "AP" or "Client"
4. If it says "client", execute ``sudo switch-ap.sh``.
5. Now reboot the PiFinder with ``sudo reboot``.

After the reboot, PiFinder presents with an open Access Point with-out encryption.

SkySafari
===================

Expand All @@ -604,8 +627,11 @@ Shared Data Access

In the course of using the PiFinder several data files are created that may be of interest.
These are available via a SMB (samba) network share called ``//pifinder.local/shared``. Accessing this will depend on your
OS, but the PiFinder should be visible in a network browser provided. There is no password requirement,
just connect as ``guest`` with no password provided.
OS, but the PiFinder should be visible in a network browser provided. On Windows, open up file explorer and enter
``\\pifinder.local\shared`` in the address bar. On Mac, open Finder and select Go > Connect to Server and enter
``smb://pifinder.local/shared``. On Linux, you can use the file manager or command line to access the share.

There is no password requirement, just connect as ``guest`` with no password provided.

Once connected, you'll see:

Expand Down
Binary file added help/object_details/2.xcf
Binary file not shown.
Binary file added help/wifi_connect/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/wifi_connect/1.xcf
Binary file not shown.
Binary file added help/wifi_connect/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/wifi_connect/2.xcf
Binary file not shown.
Binary file added help/wifi_connect/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/wifi_connect/3.xcf
Binary file not shown.
2 changes: 1 addition & 1 deletion pi_config_files/hostapd.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
country_code=US
interface=wlan0
ssid=PiFinderAP
ssid=PiFinder-CHANGEME
hw_mode=g
channel=7
macaddr_acl=0
Expand Down
3 changes: 3 additions & 0 deletions python/PiFinder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ def main(
os_detail, platform, arch = utils.get_os_info()
logger.info("PiFinder running on %s, %s, %s", os_detail, platform, arch)

sys_utils = utils.get_sys_utils()
sys_utils.Network.configure_accesspoint()

# init UI Modes
command_queues = {
"camera": camera_command_queue,
Expand Down
34 changes: 33 additions & 1 deletion python/PiFinder/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,15 @@ def advanced():

@app.route("/network")
@auth_required
def network_page():
def network_page(err_pwd="", err_country=""):
show_new_form = request.query.add_new or 0

return template(
"network",
net=self.network,
show_new_form=show_new_form,
err_pwd=err_pwd,
err_country=err_country,
)

@app.route("/gps")
Expand Down Expand Up @@ -418,10 +420,39 @@ def network_delete(network_id):
def network_update():
wifi_mode = request.forms.get("wifi_mode")
ap_name = request.forms.get("ap_name")
ap_passwd = request.forms.get("ap_passwd")
wifi_country = request.forms.get("wifi_country")
host_name = request.forms.get("host_name")

error_triggered = False
err_pwd = ""
if self.network.is_ap_open():
ap_encrypt = request.forms.get("ap_encrypt")
if ap_encrypt == "1":
try:
self.network.enable_encryption()
self.network.set_ap_pwd(ap_passwd)
except Exception as e:
err_pwd = "Invalid password: " + e.args[0]
error_triggered = True
else:
try:
self.network.set_ap_pwd(ap_passwd)
except Exception as e:
err_pwd = "Invalid password: " + e.args[0]
error_triggered = True

err_country = ""
if wifi_country not in self.network.COUNTRY_CODES:
err_country = "Invalid country code"
error_triggered = True

if error_triggered:
return network_page(err_pwd=err_pwd, err_country=err_country)

self.network.set_wifi_mode(wifi_mode)
self.network.set_ap_name(ap_name)
self.network.set_ap_wifi_country(wifi_country)
self.network.set_host_name(host_name)
return template("restart")

Expand Down Expand Up @@ -969,6 +1000,7 @@ def time_lock(time=datetime.now()):
)
except (PermissionError, OSError):
logger.info("Web Interface on port 8080")
debug()
run(
app,
host="0.0.0.0",
Expand Down
Loading