Lunchtime RTLSDR

I want to use my iPad to listen to 101.5 FM. Before you mention that I could find the online stream, and yeah, I know that's a thing, that's too easy.

This is the Raspberry Pi 4 running headless, displaying it's IP and wifi SSID, and connected to a Software Defined Radio (the silver USB dongle) which is in turn connected to the antenna hanging in the tree. It's taking its audio from the FM channel and streaming it over the USB-C connection to the iPad over VLC.

The script looks like this:

#!/bin/bash

rtl_fm -g50 -f 101.5M -M wfm -s 180k -E deemp |\ sox -traw -r180k -es -b16 -c1 -V1 - -t flac - |\ cvlc - --sout '#standard{access=http,mux=ogg,dst=10.55.0.1:8080/audio.ogg}'

I would love to claim that I knew all of this, but I picked it up from a random google result that has since escaped my history, else I'd credit the writer. Whoops.

RTL_FM is telling the radio how to hit my station. Sox is taking the raw output of that and encoding it, and cvlc is my transmitter. On the iPad, I've asked VLC to play the stream from http://10.55.0.1:8080/audio.ogg and I get to hear my station.

It has some occasional issues where the audio drops, and I'm working through that. My intention is to also pipe my Pi's pulseaudio output to the same method so that I can hear what it's doing; that's my last impediment to running DOSBox with audio and without shenanigans using iPad Dev Mode and signing packages every seven days. Need to remember this link.

Impressions of AI and Scripting

The AI instances I've worked with to help me build code are suffering terribly from Dunning-Kruger; it has no idea how bad the code it generates actually is.

What makes that particularly damning is how subtle some of the problems that it introduces are. An example was a recent request for devising a Powershell script to check the contents of Zip files for Authenticode signatures. Now, I know how to build a temp space and decompress files and scan them; I was hoping for a better method. In Linux, there are thanks to Fuse filesystems, but let's not get bogged down.

The method Copilot provided looked good, and even scanned my test file successfully. However, when it finished on my production file set, my list of files within files came back utterly broken. This is because Copilot's approach was based on some assumptions about zip file structure that just aren't always true. Net result, I ended up going back to the old reliable.

.. later..

Another example. I need to break up a string of semantic version numbers to compare by the third integer. In most SQL's, that's trivial, but not if you happen to be locked into an SQLite that's compiled without support for four arguments to instr(). I tried Copilot and ChatGPT; both of these seemed to understand this limitation, and offered me code to work around this, but both of them kept offering code that continued to include that fourth argument. I ended up solving it by moving left and breaking the value into columns when populating the table, however the arguments that I had with both system showed me the current limitations of AI in fairly short order.

I think there are cases for using AI to help you code, but I don't see AI replacing programmers any time soon.

Considering how often my prognostications prove to be wrong, though, you might want to learn another skill set.

Wiring an e-ink Display to the iPad RPi4

Documentation for the unit's here

I'm using this unit.

The PI's GPIO pins numerate left to right, top to bottom with the microSD on top.

ModuleColorNamePi Pin
VCCGray3.3V17
GNDBrownGND20
DINBlueMOSI19
CLKYellowSCLK23
CSOrangeCE024
DCGreenGPIO 2522
RSTWhiteGPIO 1711
BUSYPurpleGPIO 2418

The Waveshare Gitlab Library works well. I wrote a shell script to check my wifi and SSID and update the display if it changes. The script also use BASH's "trap" to clear the display when the box shuts down.

Next up is getting kismet scanning. I see the purchase of a wifi dongle in my future.

Raspberry Pi 4 as an iPad extension

How to use a Pi G4 as an iPad module

Interesting. I think I might give this a try.

.. later ..

I did try it, and it's fantastic. There are utility functions I find myself needing to do like accessing oddball filesystems, or using persistent sshfs connections, or all manner of other things that I flat out can't do w/ an iPad, but now I can fill that gap quite easily.

It is rough on your battery, though, since you're feeding both the iPad and the RP4, and there's not a way to charge while you're doing that. I'm going to look at perhaps powering the RP4 over the GPIO pins so that I can disconnect the iPad and leave the pi doing whatever I've got it doing.

.. even later still ..

You can’t power the Pi over GPIO and the USB-C at the same time. The Pi has no means to not take power over both and fry; glad I didn’t find this out the hard way.

-- later yet

Just in case the host sites should for whatever reason disappear on me, and since I've had to do this more than once:

  • Change /boot/config.txt and either add or change:
framebuffer_height=768```

`[all]`
`dtoverlay=dwc2`

 - Change /boot/cmdline.txt, add to end of line:  

`modules-load=dwc2`

- Change /etc/modules and at end add:

`libcomposite`

- We want to prevent the USB0 lan adapter from picking up a dhcp client address, so we edit /etc/dhcpcd.conf and add at end:

`denyinterfaces usb0`

- Install dnsmasq:

`sudo apt install dnsmasq -y`

- Edit etc/dnsmasq.d/usb

`interface=usb0`
`dhcp-range=10.55.0.2,10.55.0.6,255.255.255.248,1h`
`dhcp-option=3`
`leasefile-ro`

- Enable that service : 
`sudo systemctl enable dnsmasq`
- Create /etc/network/interfaces.d/usb0 
`auto usb0`
`allow-hotplug usb0`
`iface usb0 inet static`
` address 10.55.0.1`
`  netmask 255.255.255.248`

- Place https://magpi.cc/hardill script into /root.
- edit crontab -e
`@reboot bash /root/usb.sh`




Tindie Wish List