"Well, again, the weather station"? Not really

Original author: rricharz, GPL v3.0
  • Transfer
  • Tutorial

The proposed weather station is based on a home-made PIDP11 computer , consisting of a raspberry with a PDP-11 emulator and a case with a front panel with active LEDs and switches. But despite this, the "raspberry" has enough unoccupied GPIOs to connect also a pressure and temperature sensor.

The emulator runs OS 2.11BSD, in which the weather station software is “spinning”. Data is output to two terminal emulators. One of them - cool-retro-term - displays text information in large print using ASCII art. The second - a Tektronix 4010 graphic terminal emulator with a storage tube - displays the curves of pressure and temperature.

The method for connecting the BME280 sensor is described here :

Обозначение | Назначение   | GPIO на
на плате    |              | Raspberry Pi
датчика     |              |
VCC         | 3,3 В        | P1-01
GND         | Общий        | P1-06
SCL         | SCL шины I2C | P1-05
SDA         | SDA шины I2C | P1-03

The OLED display shown in the photo below is connected in parallel with the sensor, but it is assigned a different address on the I 2 C bus . If you wish, you do not need to install a display at all. The author also set a button for the correct shutdown of the OS before turning off the power.

To make the device work, the first thing to add to the new user running in the 2.11BSD emulator is as follows :

Log in as the root user. Enter the vipw command to start the vi editor with the file / etc / passwd

Place the line in the file:


where firstname and fullname are the short and full usernames.

Exit the editor, create the user’s home folder:

cd /home
 mkdir firstname
 chown firstname firstname

Copy the .login and .cshrc files to this folder '

 cd /home/user
 cp .* /home/firstname
 cd /home/firstname
 chown firstname .*

Type vi .login and edit the command line prompt by changing the corresponding line to:

set prompt='%n@%m:%c$ '

Exit the editor. Log out with the logout command, change the password for the new user with the passwd command under the root, now you can log in using the username and password of the new user.

After that, you need to make the date and time in the system automatically set at boot time, so (for the information below, the author thanks Jason Vanick and Johnny Billquist):

First configure the network and make sure ping works. Then, immediately before the ntpt line in the /etc/rc.local file, put the line:

ntp -sf pool.ntp.org

Change the last line in the /etc/ntp.conf file to:

server pool.ntp.org

You can select any other NTP server. To set the time zone, check the list of zones in the file / usr / share / zoneinfo and find the name of your zone there. Log in as the root user and enter the commands:

cd /etc
mv localtime localtime.old
ln -s /usr/share/zoneinfo/timezone localtime

The next operation is to install and configure a program that will allow you to forward a Raspbian command line running on a real “ malink” to the 2.11BSD command line running in the emulator, like this :

In Raspbian, enter the command under root:

sudo apt-get install rsh-server

Create a .rhosts file in the home folder with the following contents:

bsd_ip_address bsd_user_name

where bsd_ip_address is the IP address of the virtual machine with 2.11 BSD, and bsd_user_name is the name of the user in 2.11 BSD who can execute commands on a real “raspberry”, for example: rene

Set permissions for this file, otherwise nothing will work:

chmod 600 .rhosts

Go to the emulator, enter 2.11 BSD as the root user and edit / etc / hosts - add the line:

remote_ip_address remote_full_name remote_nick_name

where remote_ip_address is the IP address of the real “raspberry”, and remote_full_name and remote_nick_name are its domain name and alias, for example: pizerow.home.lan pizerow

Log in using the previously set name (bsd_user_name) and check if everything worked:

rsh remote_nick_name -l pi -n “ls”

You have just executed the ls command from the emulator on a real malink. If, instead, a password entry form appeared in front of you, it means something went wrong.

Now try something more complicated. Enter the command:

rsh remote_nick_name -l pi -n “cat /sys/class/thermal/thermal_zone0/temp”

In the rtest folder of this repository there is a small C program that shows how to use popen to get information from a particular program and process it in such a way as to obtain human-readable output in 2.11BSD:

rene@pdp11:rtest$ rtest
* The CPU temperature on the pizerow is 42.2 deg C *

You just saw in the emulator the temperature of the real processor on which this emulator is “spinning”.

Download the Python script from the weather / sensor folder of this repository.

Make sure that the script works correctly in remote pizerow and place it in the / home / pi / bin folder

Run cool-retro-term and the emulator, enter 2.11BSD as the user you just created and enter the commands:

mkdir weather
cd weather

In one way or another (for example, using FileZilla) drag and drop files from the weather / BSD folder of the repository into the weather folder of the OS running in the emulator. Enter the weather command, and the program will extract the data from the sensor and display it in this form:

 rene@pdp11:weather$ weather
 Contacting remote sensor...
 Data received, analyzing ...
 The sensor reports the following data:
 Temperature 7.0 C
 Pressure 969.8 hPa
 Humidity 66.8 %

If everything worked, create the dats folder in the ~ / weather folder, where weather2 can store the log:

cd weather
mkdir data

Weather2 I started every day to create in the ~ / weather / data folder by the file with the name corresponding to the date, and add a line with the data to it every minute. And he will continuously output the following to the terminal, updating the screen also once a minute:

Well, weather3 works the same way, only displays more time and pressure. It uses the curses library to move the cursor.

Try also to display the temperature and pressure values ​​in the previous days in the same way, and also write a script to obtain weather forecast based on these data. Good luck!

Appendix 1 - installing and configuring cool-retro-term

Appendix 2 - installing and configuring the Tektronix 4010 graphic terminal emulator

Also popular now: