I love Chopin’s Preludes for their endless creativity. The 2/8 time signature in this one is uncommon, but used to great affect and realized as a nice triplet – duple rhythmic pattern throughout most of the song. This performance is not an interpretation, just my amateur rendering.
In my previous post, I set up the ability to ssh into a pi zero (not pi zero w) via usb. Since I got that far, I was pretty sure it was possible to give internet access to my pi zero through my laptop. Turns out it is not that difficult. First I set up a default route on the pi to send all packets not on the local subnet to my laptop:
sudo route add default gw 169.254.75.231
Now here is my routing table on the pi:
Next, I set up my laptop to essentially be a NAT router for the pi zero. This is how to share my laptop’s internet connection with my pi:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE
iptables -A FORWARD -i enps0s18f2u1 -j ACCEPT
Now my pi zero has internet access. I tested by pinging my favorite dns server 220.127.116.11. However, when I try to ping my beloved employer’s domain, I get nowhere. After I added a dns server to /etc/resolv.conf, I am good to go:
I am working on a data logging project based on the raspberry pi zero. NOT a pi zero w, just the pi zero. Adding software packages to the pi zero is a little more difficult, because it has no wifi or ethernet connection. I have been taking the sd card out ant putting it in a pi 3b+ to get packages that I need then putting it back in the pi zero. I have tried and failed to use minicom and zmodem to transfer deb files over UART.
I found this great tutorial that explains how to ssh into a pi via the usb port on the pi. I did everything it said and was still not able to connect to the pi. I did an ifconfig on the pi, and saw that it had a APIPA on it’s usb network interface like so:
I had a usb network interface appear on my laptop, but no ipv4 address:
I finally got it to work by issuing an ifconfig command to my laptop’s usb interface and assigning an IP address in the same class B subnet :
Another benefit to a standard pi zero having ip connectivity via usb is that you can use piscope for troubleshooting. Here is piscope examining i2c frames polling an HTU21D relative humidity sensor:
This is me playing an instrumental of ‘Oh love that will not let me go‘ arranged by Larry Shackley from his collection, Sacred Rhapsody. He describes it as being after the style of Chopin. It reminds me of Chopin’s first two nocturnes from Op. 27 because of it’s unshackled right hand over the left hand’s flowing arpeggios. A very pianistic piece, I love its use of musical effects such as the polyrhythm in the last section where the right hand is playing the melody in eights against the left hand’s triplets.
O love that will not let me go, I rest my weary soul in thee.
I give thee back the life I owe, that in thine oceans depths its flow.
May richer fuller be.
In my empirical observations experimenting with a dht22 temperature / humidity sensor, I have come to the conclusion that they are most definitely for INDOOR USE ONLY! Any time I placed one outside, they quickly max out at 99.9% humidity, and don’t recover until I dry them out, and place them indoors. I have ordered a HTU21D-F sensor to replace the dht22 in my rf propagation / humidity experiment.
The dht22 does work pretty well indoors. I took over 14K samples over a 30 hr period and got clean results.
The temperature is in red and the humidity in green. For most of my data logging projects using a pi, I sore the results in CSV format. I used perl’s CSV database functions to query results and create graphs. This is the sql query I use on the to csv tables to get the above graph:
select data.index, data.temp, temp_humidity.humidity from data outer join temp_humidity on data.index = temp_humidity.index
I would assume many makers are familiar with using a logic analyzer in conjunction with sigrok + pulseview. I love these resources. They allow you to analyze precisely what is happening on your digital IO pins on whatever microcontroller you are using whether it be arduino, raspberry pi, etc. They can also analyze signals at the protocol level such as i2c and are so inexpensive every maker should be equipped with these tools.
I do not like to reinvent the wheel in most cases. I wanted to use some dht22 temp / humidity sensors on an RF signal strength project I am still working on. As I have mentioned in earlier posts, I chose to use the RPi::PIGPIO::Device::DHT22 module on cpan to read my sensor. This required the pigpiod daemon to be running on the raspberry pi. I am very impressed with PIGPIO. It allows you to very easily read / write to a raspberry pi ‘s GPIO lines over TCP/IP. Just think of the possibilities.
The author of PIGPIO also offers an incredible logic analyzer for the raspberry pi called piscope. I may never use a standard logic analyzer on a pi ever again. You can invoke piscope on any linux computer once you have installed it to analyze the gpio on a remote pi.
After this, launch piscope:
I am just beginning to experiment with piscope, but so far it is very user friendly. This is a trace of the SDA and SCL lines on the pi reading an MCP9808 temperature sensor.
This trace was taken over the net. I didn’t have to get out my logic analyzer and connect any test leads. Here is a trace of a poll and response from a dht22 sensor connected to gpio 24.
You can see it go low, then the sensor sends its reading, and goes high again. pigpiod is definitely a resource hog, but that is hardly a consideration for my uses of the pi in my projects. I will definitely be incorporating piscope into my future projects.
piscope by default uses port 8888 on the pi you are monitoring. Out of curiosity, I scanned the incoming frames with tcpdump.
It sends a lot of traffic over the network.
Here is a video of me launching piscope, and live traffic from a pi 3B+.