3DScanner contient tout le logiciel nécessaire au fonctionnement du scanneur 3D de Hublot.
-
Flash OS with Raspberry Pi Imager. For this step, you need admin privilege each time you run Raspberry Pi Imager, so maybe use your own laptop. Use the latest version of Bullseye (See screenshot for the one I used). You should check the parameters before installation, especially:
- Set the hostname (I used scanner3D-RD, but you can put anything you want)
- Set username and password. You will have to enter the password to SSH to the RPi, so remember it.
- Configure wirless LAN with the wifi RD (don’t forget to check hidden SSID)
- Enable SSH
Older version may not support the camera, newer version may have different networking architectures. You can try with bookworm but I have not tested it.
-
Insert the SD card into the RPi, connect ethernet and power.
-
Connect to RPi from a computer with SSH. The two devices must be connected to the same network (I used the desktop computer connected with ethernet, but you can do the same over the RD wifi). For that, I used Visual Studio Code with Remote - SSH extension, but there are other options. If you wish to use VS Code (which I recommend), follow the guide:
Due to my situation, I had to connect to the RPi by SSH over ethernet. However, this ethernet connection could not provide internet acces to the RPi. So I had to use a wifi network and change the priority in the RPi. If your setup is different (for example, if you only use wifi), you can skip this step.
-
Open terminal
-
sudo nano /etc/dhcpcd.conf -
Add these lines at the end:
interface eth0 static_routers=10.88.141.250 static domain_name_servers=10.88.140.12 request ip_address=10.88.141.53 #metric 350 interface wlan0 request ip_address=172.23.9.208 metric 200 #interface wlan0 #nohook wpa_supplicant #static ip_address=192.168.50.10/24 #static routers=192.168.50.1 # fallback to static profile on eth0 #interface eth0 #fallback static_eth0
-
Save and exit nano using ctrl+X then Y
-
Reboot the RPi (
sudo reboot) -
Check that it worked using:
ifconfigshould show the two interfacesping google.comshould not time out
Open a terminal and update everthing (enter line per line)
sudo apt update
sudo apt full-upgrade
sudo apt install raspberrypi-kernel-headers
sudo reboothttps://github.com/GuillaumeChpn/3DScanner.git
-
Go to the GitHub repo and copy the link
-
In source control, click Clone Repository button, then paste the link in the dialog box
-
Accept the default location and open the location as suggested.
- From the folder where you have cloned the repo, create a python virtual environment:
python3 -m venv scan_venv --system-site-packages - Activate the virtual environment:
source ./scan_venv/bin/activate - Install all required libraries:
pip3 install -r ./requirements.txt -vvv. Don’t worry, it takes a lot of time, for me 1h30 approx. - Install NGINX:
sudo apt install nginx - Install ExifTool: Installing ExifTool. For simplicity, you can download the .tar archive on your computer then drag and drop it to a folder of the RPi using VS Code.
Server:
-
Create a new daemon dedicated to the server:
sudo nano /etc/systemd/system/3DScanner.service[Unit] Description=Server for my Flask application After=network.target [Service] User=pi Group=www-data WorkingDirectory=/home/pi/3DScanner ExecStart=/home/pi/3DScanner/scan_venv/bin/python wsgi.py [Install] WantedBy=multi-user.target -
Change file permissions:
sudo chmod u+rwx /etc/systemd/system/3DScanner.service -
Reload daemons:
sudo systemctl daemon-reload -
Start the server:
sudo systemctl start 3DScanner.service -
Make the server start at boot:
sudo systemctl enable 3DScanner.service
Reverse proxy (NGINX):
-
Create a new configuration file:
sudo nano /etc/nginx/sites-available/3DScannerserver { listen 80; server_name _; location / { include proxy_params; proxy_pass http://127.0.0.1:5000; } } -
Enable the new configuration:
sudo ln -s /etc/nginx/sites-available/3DScanner /etc/nginx/sites-enabled -
Disable default configuration:
sudo rm /etc/nginx/sites-enabled/default -
Reload daemons:
sudo systemctl daemon-reload -
Restart NGINX:
sudo systemctl restart nginx.service -
Make NGINX start at boot:
sudo systemctl enable nginx.service
The goal is that the RPi creates a wireless network when booting. Be careful, a lot of tutorials do not work for RPi OS Bullseye. I followed this one: RPi Access Point dhcpcd method
-
Install required software:
sudo apt install hostapdandsudo apt install dnsmasq -
Stop the daemons during configuration:
sudo systemctl stop hostapdthensudo systemctl stop dnsmasq -
Create a config file:
sudo nano /etc/hostapd/hostapd.confinterface=wlan0 driver=nl80211 ssid=Scanner3D RD hw_mode=g channel=6 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=bubblot4ever wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP
-
Make hostapd start at boot:
sudo systemctl unmask hostapdthensudo systemctl enable hostapd -
Open config file:
sudo nano /etc/dnsmasq.confAdd the following content to the bottom of the file:#RPiHotspot config - No Intenet interface=wlan0 domain-needed bogus-priv dhcp-range=192.168.50.150,192.168.50.200,255.255.255.0,12h -
Edit config file:
sudo nano /etc/dhcpcd.confAt bottom fo file, comment the old wlan0 config (if any) and add:#interface wlan0 #request ip_address=172.23.9.208 #metric 200 interface wlan0 nohook wpa_supplicant static ip_address=192.168.50.10/24 static routers=192.168.50.1
- Reboot the RPi:
sudo reboot - The LEDs should play the startup sequence (ON continuous, then blink, then OFF) (There may be a bug and it plays twice, but I did not find that it affect any functionnality.)
- After a few seconds, the RPi wireless network is active. Connect your device to it.
- Connect to the application by entering the RPi IP adress in any web browser (You set it at step 7.6, it should be
192.168.50.10). - Check functionnalities and scan an object.
%20from%20scratch%201f80b3a442da41e68c0a6b4bdd5e0f8a/Untitled.png)
%20from%20scratch%201f80b3a442da41e68c0a6b4bdd5e0f8a/Untitled%201.png)
%20from%20scratch%201f80b3a442da41e68c0a6b4bdd5e0f8a/Untitled%202.png)
%20from%20scratch%201f80b3a442da41e68c0a6b4bdd5e0f8a/Untitled%203.png)