This website is hosted by nginx on Ubuntu 20.04.3 LTS server using rapberry pi hardware, following the Kindle book 'Selfhosting: Server aufsetzen und betreiben' by Florian BOTTKE, see chapter on web server.
Temperature and humidity sensor: RAK Temperature and Humidity Sensor Sensirion SHTC3 SKU: 100001 here
Current and voltage measurement device: DC Current Sensor 3A Texas Instruments INA219BID here
Antenna: Alfa Network LoRa/HaLow 868MHz Antenna 5dBi N-Male Connector AOA-868-5ACM here
Antenna SMA adaptor and bulkhead mount: TUOLNK N Female to SMA Male 4 Hole Flange Plate Connector here
IPEX to SMA connector: Hailege IPX IPEX-1 U.FL to SMA Female Pigtail Antenna here
Bluetooth antenna: KHIYQILO WiFi Antenna 2.4GHz 3dBi SMA Connector IPEX Bluetooth here comes with all the parts needed to fix it to the box
Battery solar charger: Hailege CN3065 Mini Solar Lipo Charger here
Battery: EREMIT 3.7V 10.000mAh LiPo Battery Order number 1260100 (Connector JST-PH 2.0 mm) here
USB C port: PENGLIN 2pcs Type-C Female Panel Mount Connector, Aluminium Alloy USB 3.1 Feed Thru Coupler Female to Female Module Converter with Dust Cover here or similar
Box: Waterproof Junction Box, IP65 Electrical Project Box, Distribution Box, Dustproof, Weatherproof, ABS Cable Housing Distribution Box for Indoor Outdoor Electronic Cable (Transparent 20 x 12 x 7.5 cm) here or similar such as RND 455-01406 - Plastic Enclosure with Clear Lid Universal 180x120x60mm Light Grey Polycarbonate IP66 / IP68 / IK07, RND here
USB micro port: QIANRENON 90° Right Angle Micro USB Panel Extension Cable Micro USB 5 Pin Male to Female Car Boat Motorcycle Dashboard Extension Cable 28cm (Right Curved Plug) here
JST 2.0 PH Connectors: GTIWUNG 20 Pairs JST Connectors, JST 2.0 PH 2 Pin Connector Plug, 2-Pin Connector Plug Male & Female, JST 2.0 mm 2-Pin Plug with 80 mm Cable Wire
Heat shrink tubing for the above wires when soldered together - very small diameter.
Solar panel: Solarzelle - 2W, 6V, 11.0 cm * 13.6 cm here
I think it needs one of these pressure equalisation plugs here
Thermal switch: Bimetallic Thermostat switch for 55 degrees C here
Before this is all put together, I will test to see if the node re-starts when battery is flat. To test I use a lamp: MILYN LED Plant Lamp with Timing and Hanging System, 9H/12H/15H Timer, 150LEDs White Full Spectrum Grow Light from here
root@pi2:/opt/ipwatch# chmod u=rwx,g=rwx,o=rwx ipwatch.py
0 * * * * /opt/ipwatch/ipwatch.py /opt/ipwatch/config.txt
in the file
/tmp/crontab.4IMiGM/crontab
which is the default used when running
root@pi2:~# crontab -e
to edit the crontab (done as root).
With systemctl status cron
this is the status, and this site explains some of the messages. The emailing of the new IP address works fine.
I am wondering if a MTA can be installed in the Pi, and used to make a much easier python script than the one linked above (which seems rather complicated) that checks an IP change using ifconfig.me
on a regular basis and then uses the MTA. There should be a simpler way of doing this via a dyndns server such as dynu which, with a suitably installed code on the computer, will keep the DNS server automatically informed of the IP address change and then one can use a domain name to log in, instead of the constantly changing IP address. Following those instructions and using apt-get install ddclient
which launches a series of input screens in the terminal, and trying it again (following some error messages like this in some input screens) with sudo dpkg-reconfigure ddclient
and using the option for a separate so called "IP update password", a file /etc/ddclient.conf
was generated. Ran sudo systemctl start ddclient.service
but looks like I will have to rummage here in github. So this command ddclient -daemon=0 -debug -verbose -noquiet
shows there is a permissions denied problem witht the .conf file which has the following permissions -rw------- 1 root root 184 Apr 20 00:00 ddclient.conf
which I changed like this:
sudo chmod u=rwx,g=rwx,o=--- ddclient.conf
and also
pi@pi2:/var/cache/ddclient $ sudo chmod u=rwx,g=rwx,o=--- ddclient.cache
which seemed to remove the permissions problem (at least once), though can't think why.
Initially I stupidly tried putting my o2 spot router settings to be the same as the ddclient settings, but this was a red herring - the DDNS on the o2spot router is deactivated and not used.
My ddclient settings reported the following error:
WARNING: file /var/cache/ddclient/ddclient.cache, line 3: Invalid Value for keyword 'ip' = ''
RECEIVE: badauth
FAILED: updating xxxx.com: badauth: Bad authorization (username or password)
Using this link's example ddclient.conf might have helped, but did not.
Typing the public IP into the relevant field in dynu.com DDNS GUI website settings permits access immediately to the computers connected to the o2 spot using the domain name. Thus there was a problem with ddclient. It was set up using the wrong server domain name. Using "api.dynu.com" as the server in ddclient.conf seems to be what fixed it, and now the ddclient.conf file that works looks like this and the command ddclient -daemon=0 -debug -verbose -noquiet
yields the following output. Note that the ddclient.conf file generated by the process of data entry after running apt-get install ddclient
was no use. A login via ssh is now possible into both the raspberry pi as shown here as well as the VisionFive RISC-V via the same domain name, as shown here. Waiting till the following day after an IP address change by the router showed that the dynu.com DDNS service was successfully updated and shh via the domain name works after the IP address of the o2spot router has changed. ssh via a smartphone also works nicely using the app JuiceSSH.
sshenanigans fail2ban
If you have iptables installed, which you can check with iptables -L
, this link explains installation of fail2ban for the rasperry pi and this link shows you how to install fail2ban for fedora (but the visionfive Fedora 33 did not require sudo dnf install epel-release -y
as specified in that link). fail2ban protects your ssh connection/port from attack and is essential.
The project plan The plan is to compare one of these, a VisionFive V1 Risc V single board computer (SBC) (and the updated version 2, see above) with the pi. Here they are head to head in that cupboard and getting on well, or be it a bit of a squeeze.
The VisionFive is a RISC-V single board computer that can run Fedora linux. It comes direct from PRC with a flash drive with Fedora already installed, though it can be gotten off GitHub. The device is open source from the OS to the instruction set architecture (ISA) due to using RISC-V. This is a big deal (in my opinion).
The above way of connecting it to the internet via the o2spot quarantines the device from my home network and computers, while the provenance of the software, though open source, is being tested.
In case anyone was wondering why the abundance of caution, this nightmare story is a perfect example of the issues involved.
ssh to two different computers on the same router - WAN settings
For some reason I at first was not able to ssh into the VisionFive directly, though I could ssh into the PaspPi. My wrong router settings were these. This is a thread about this ssh issue, and here is another. There it was pointed out that I need to set a different WAN port e.g. nnnn for the VisionFive in the o2spot router, as shown here, and then ssh using the command:
ssh -pnnnn username@publicipaddress
That indeed works, but it is not clear why it was always the PaspPi that connected OK and never the VisionFive when the same WAN port was incorrectly used for both... never mind.
(A work-around was to ssh into the pi public IP address from an external network, and ssh to the VisionFive from the RaspPi.)
Using Tilix I can then have a RaspPi terminal via ssh, and also a VisionFive terminal via ssh next to each other for testing, see screenshot. That way I do not have to spend all my time in that cupboard!
The only remaining issue is to work out why the ssh connection/s simply time/s out all the time....
Case and cooling the visionfive quietly
The heatsink with fan (link to store) that was supplied with the visionfive cooled the device very well, but made an infernal noise. I wanted the visionfive to be in some sort of case to protect against damage. Using perspex sheets and M3 spacers one can make a case open at the sides. Using a heatsink with fan (link to store) and another second fan (link to store) I was able to cool the visionfive processor but without all the noise. The heatsink that was supplied was kept, but the loud fan removed, and in place of removed fan the heatsink with fan was stuck onto the supplied heatsink, and the second fan mounted under a large hole made in the top plate of the housing. I have the same fan on the case of the raspberry five running this web-site and it works very quietly and for a long time without problems. The two fans' leads were soldered (keeping plus wires connected to each other) to the wire from the fan socket (the fan socket was not compatible with the plugs on the two fans). Without two fans, but only the fan with heatsink installed, I found that the temperature of the processor reached 55 deg C when the top of the case was in place (with only a few 3.5 mm diameter holes drilled in the top of the case). Thus I decided to place a second fan in the top of the case with a much larger single hole for the fan intake. With the two fans arranged as shown here it was well below 40 deg C, about 38 deg C. There is no reason to believe the device required this amount of cooling, but I thought that it would be interesting to compare the measures needed to cool the visionfive with the fan-less design of the raspberry pi. The raspberry pi runs fanless in a closed aluminium case (shown below) at about 40 deg C, and the two-fan set-up described above at about 38 deg C, as shown here. The noise from the two fans is much less loud and less penetrating in tone than the noise from the single fan as supplied.
Running comparison tests in python.
1) Use this timing code. The VisionFive has considerable trouble installing pandas, over a slow internet link, but gets there slowly.... it seems, but the CPU had a
hard time of it.
The better command is, because it is Fedora: dnf install python3-pandas
which works perfectly, as shown by the resulting message which mentions the library is for RISC-V - lovely Fedora !
Timing test: generating 10,000,000 integers in range 1 to 9999 and convert these to text (using the above link's timing code). The raspberry pi 4 was about 9 times faster on average, as shown below. The pi does have 2 extra processors, it should be noted. A Dell Inspiron and MacBook Pro M1 2021 is also thrown in for good measure.
2) This link very kindly provided by Bruce Hoult, shown below, indicates the potential way using RISC-V assembler direcly on the vision five, rather than using an emulator. Bruce mentioned "Note that using .S for the file name instead of .s allows you to use the C preprocessor in your assembly language source code. This can be useful for conditional compilation and defining constants and other macros.". He also explained that 1b
in the line blt s0, s1, 1b
is a local symbol name referring back to the loop labled 1
, as explained in the GNU manual here. The code is available on github.
Lo and behold, the assembler routine above works on the visionfive.
To run a c program from python is explained in this link.
To time the complied assembler code I use this python file.
The output is shown below.
A head-to head shows calling compiled assembler seems not to be faster that python directly
In fact re-running the python that uses a call to the complied assembler often yields about 0.012 seconds, and the python code is never more than 0.0039 seconds, sometimes 0.00066 seconds.
To compare the speed of python in the visionfive with the speed of python in the raspberry pi, see here, which shows that for this the raspberry pi is, as in the above tests, of the order of 10 times faster than the visionfive.
However using the built-in bash time
tool yields totally different data indicating that running the compiled binary "hello" is faster, which begins to make more sense:
Further assembly programs are available here and here and here.
RISC-V assembly
Here is a nice RISC-V project site.
Anthony Shaw has written a detailed description of the use of assembly in python, with code available in Github.
PeachPy on Github.
How to write assembler well is suggested here.
This RISC-V about sockets is rather neat, to say the least.
This video is a very nice introduction to programming in RISC-V.
Theses series of videos teaching risc-v assembler are spot on.
This page explains things about fprint, and a0, a1, a2 and even mentions floating point operations.
If you want to see a mega assembler code, try this, which seems to give you e.g. Mandelbrot on a plate. And it worked directly on the VisionFive:
Here is a blogger blogging with real code, superb!
This introduction is rather good as it seems to include the very essentials: which are used also in here by the same author.
This document appears to have nice lists of examples of code at the end: with more resources here.
This link seems to be very concise and shows use of fprint.
More RISC-V boards
Another RISC-V beauty.
This site seems to be about the Sipeed Lichee RV RISC-V running under OpenZFS.
The Sparkfun RED-V Development Board has a video review here.
This nicelink is for the gd32vf103.
This link is for the Canaan K510 CRB RISC-V AI development kit.
Another riscv board is mentioned here, which is about the MangoPi SBC.
The above heading was for affordable ones... well ones where the price is known... but one has to mention other ones too even perhaps if the price is not immediately apparent.
SiFive has of course always flogged riscv boards.
Codasip is another riscv processor supplier. Currently seem to be applying RV32IMCB which is apparently RV32I plus M(ultiply), C(ompressed) and B(it manipulation) instruction set.
A pico type board.
A really small board.
Pine64 board also described here.
LicheeRV riscv board for under $20 runnng Ubuntu. OMG.
Tiny board indeed.
Uconsole is a complete mini riscv computer.
D1-H Development board Nezha looks neat and can run Ubuntu apparently, see here.
A development board which looks dinky.
RISC V cores / chips / processors only (not with boards)
A totally random incomplete list.
AX60 muticore processor.
T-Head XuanTie C908 RISC-V core targets IoT.
RISC-V chit-chat
I though this thread about RISC-V was interesting, as was this article about the difficulties of making processors.
It seems that Ubuntu Budgie should work on RISC-V systems , and the Jammy Jellyfish is also reviewed here, as well as here which explains the flavours. Interesting that RISC-V seems not to be mentioned in all reviews, though this one does.
RISC V summary to November 2022.
Use pihole as your DNS server to eliminate adverts etc. Easy to do on a fritzbox. Best to use a raspberry pi in a case that does not require a fan, e.g. using an aluminium case. That way no moving parts nor nor noise.
Vodaphone de cable router FRITZ!Box 6591 does not allow one to use pihole as a DNS server. Apparently, the router as rented from vodaphone has this option rendered unavailable. It seems one can buy the same router from other sources and the required fields to set pihole as the local DNS server are available.sudo nmcli connection delete pvpn-killswitch
sudo nmcli connection delete pvpn-ipv6leak-protection
rm -rf ~/.cache/protonvpn
rm -rf ~/.config/protonvpn
was ultra easy and Proton VPN was back up and running immediately.
Freaky thing is that Startpage blocked my IP address when using ProtonVPN.
Just a video showing RAM installation in an 2nd-hand PC. Yawn.
THIS IS GONNA BE A LOADA FUN
See also this page for info on a minecraft server.You can execute Python code by entering it in the box above and clicking the button once "Ready" appears.
Try pasting the following 7 lines all at once into the box above (only paste in if 'Ready' is shown): from itertools import combinations my_input_list = ["(*A,*Z)","*B","*C","*D"] l=list(combinations(my_input_list, r=2)) number_of_combinations = len(l) anded_list = list() exec("for i in range(0, number_of_combinations): anded_list.append(' and '.join(l[i])) ; anded_list_as_string = ', {not yet done} '.join(anded_list)") anded_list_as_string This link gives you a Python compiler. You can paste the following from itertools import combinations my_input_list = ["(*A,*Z)","*B","*C","*D"] l=list(combinations(my_input_list, r=2)) number_of_combinations = len(l) anded_list = list() exec("for i in range(0, number_of_combinations): anded_list.append(' and '.join(l[i])) ; anded_list_as_string = ', {not yet done} '.join(anded_list)") anded_list_as_string into the Shell field on the right-hand side in the above link and simply immediately press return in that field (not 'run' button). The final line of output following anded_list_as_string i.e. the text between ' ' in the final line is the new marker item syntax that defines all the combination of marker items from my_input_list.