Skip to main content

Post in evidenza

Router table with power lift, built around Ikea BEKVÄM and parts from old drafting machine

This is my (quite) completed router table built around IKEA kitchen cart BEKVÄM and a precise drafting machine cannibalized.










Router is a Bosch POF 1200.
Router table is equipped with power lift feature (missing only router support in the photos).

IOT RECIPE: 04 Headless Raspberry Pi programming

How many monitor you need to have to program a Raspberry Pi. 
No one, as you now: with ssh is possible to interact with Raspberry Pi from a remote machine. The majority of distributions enable SSH by default, so you can access it once connected to your local network with command ssh username@rpiname.local and replace rpiname with raspberry host name.
With text-only Nano editor is also always possible to develop directly on ssh interface. 

Is possible otherwise to develop a complex project like IOT Energy Monitor Webserver using a combination of SFTP, your favourite Text Editor and of course Terminal to run WebServer and debug.


SFTP Mac OSx Drive Mount



Cyberduck.io 

"Cyberduck is a libre FTP, SFTP, WebDAV, S3, Backblaze B2, Azure & OpenStack Swift browser for Mac and Windows."






ExpanDrive

"Map or Mount Amazon Cloud Drive, Google Drive, Dropbox, Box, OneDrive, SFTP, WebDAV, S3 and more as a Network Drive. Seamless access to files without sync."
ExpanDrive is not free.




Extreme text Editor

Sublime Text

"Sublime Text is a sophisticated text editor for code, markup and prose. You'll love the slick user interface, extraordinary features and amazing performance."




Atom Text Editor

"Atom is a text editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file."




Terminal


Bash (Bourne Again Shell)

Terminal is the OSx shell. From here you can connect via ssh to the Raspberry Pi shell.
OSx terminal can be customized in colors and transparency.
Copy & Paste work as expected in terminal, and more than one session may be opened, if you need to run a server and rename/move/copy/list/... at the same time.

Ssh first connection

Once connected raspi to the local network, you need to find IP to access and configure the network name (and other configurations). Personally i use router DHCP list to find the assigned IP, but more options are available, like ip scanner.
The first connection to ssh host, terminal ask you if you want to add ssh key to known hosts, tap "yes" to gain access to the machine.

Ssh offending message (RSA key changed)

Sometime, when IP changes on Raspi, you are not more allowed to connect to remote raspi: an update is needed.
Use the command "ssh-keygen -R rpiname.local" to clean RSA key, then reconnect via ssh and generate another key, as a first connection.

Lost connection while running flask server

What happens if you lose connection while a flask server is running?
The session is closed and the server is terminated. To change interval here there is a guide to change timeout interval on Raspi.  
If you want to run the flask server on startup, follow the next step.

Running python script on startup via systemd

The simplest way to run a python script on startup on Debian distro (like Raspbian) is via UNIT files.
There are a lot of guides on the web, but the majority is related to init.d script. This approach is more simpler and effective (related also to running order). I had a lot of headache running python script via init.d cause "exited" python script status.

To run a script via systemctl follow these steps:
1) Be sure your python script works as expected
2) Paste the python executable version on top of the pythons script and save: #!/usr/bin/python
3) Make the script executable with chmod +x myscript.py
4) Create a configuration file with sudo nano /lib/systemd/system/flask.service
5) Paste the following content to the nano editor session and save

[Unit]
Description=Flask server

[Service]
Type=simple
ExecStart=/absolute_path_to_script.py
User=root
Group=root
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target

6) Set unit file permission with: sudo chmod 644 /lib/systemd/system/flask.service
7) Load unit file with: sudo systemctl daemon-reload
8) Enable unit file with: sudo systemctl enable flask.service
9) Reboot

After reboot you can control status of the service, stop and restart using these commands:
  • sudo systemctl status flask.service
  • sudo systemctl stop flask.service
  • sudo systemctl start flask.service
  • sudo systemctl restart flask.service

Comments

Popular posts from this blog

PEATOL/TAIG: the most beautiful affordable metal lathe

I bought a PEATOL/TAIG because i need a small lathe (despite i have a 7x20 lathe) i can operate in my house. I have known about it from the conspicuous fans all over the world.




Here some links if you want to know more about PEATOL/TAIG:
Peatol Machine Tools: the home of PEATOL/LATHE;
Deansphotografica: beautiful projects;
CarterTools: the biggest resource i know about taig;
LeeValley Instruction booklet;

I received it from Peter of Peatol (UK) on August, and now i'm showing it once assembled the base, the motor and it's fully functional. The motor was blue so i repainted to black.
I assembled also the motor mount from aluminium with primitives dovetails. My version of lathe come with powerfeed already installed and a sturdy block of aluminium for raise the entire lathe.

This is my start package:
1015Micro lathe with power feed1030Four jaw chuck, with reversible, heat-treated steel jaws10921/16"-3/8" Jacobs chuck1150Drilling tailstock - lever operated1151Needle bearing centr…

COIN-OP: mini arcade cabinet build log

My father bought some wood panels from Ikea. He donated two to build a mini arcade cabinet for my son. The arcade cabinet will use a raspberry pi with PiMame and some Sparkfun arcade goods, like a Zippy arcade joystick and concave buttons. In this post you'll find a short build log. The cabinet is 1 meter tall (39") and 0.42 meter wide (17").

Cutting the hpl boards. Masking tape installed for marking

The monitor, a 19" sony sdm-hs95
Build log:






Monitor installation test

EMBROIDERY CNC: Software completed

The software for the cnc embroidery is finally completed and fully functional.


Screenshot: Main screen
Screenshot: Palette selection
Screenshot: Color selection
Screenshot: Artwork translate panel
Screenshot: Grbl dashboard panel (realtime via browser thanks to Websocket)
Screenshot: G-Code Inspection panel