Is my attempt at sending ip packets using morse code over a pirate radio using a raspberry pi and a wire!
20220321 - adding api server, created a
kanban board for people to see project status here
20220324 - added status video
- Raspberry pi (or BalenaFin ))
- Jumper wire standard size OR 75cm of wire
- Free Time ( Really hard to source due to international chip shortage)
Note: im using a common jumper wire because its easy to find, but bear in mind that this will have reduced performace vs a 75 cm wire, if you really want long range (not recommended due to fcc will not like you) you can go with a longer range.
If not signup here ------v
Go to your dashboard balena dashboard
Select development, if you want to modify and play around with the code, if you just want to use the project select production
Noob mistake: I made the mistake of thinking the USB could power the device on its own, and had to do some trouble shooting. takeaway, make sure the powerjack and the USB are plugged in at the same time.
download BalenaEtcher from here
- changing usb cable for better one
- unplug and plug back in.
- change usb port plugged in
- restarting etcher
- reseating the cm3 module
or try look at BalenaFin troubleshooting for more answers, if the above didn’t work
Not all usb cables are created equal! just because i through it was a data one didnt mean it actually was! good to know…
note i had to unplug my fin before the driver would finish installing, but everything worked fin after that
- plug/unplug power
- trouble shooting docs about not showing up in dashboard
- check the ethernet cable is correctly plugged in
A pattern of 4-blinks on the ACT status LED indicates that the balenaFin cannot connect to a network
I started out using F5OEO/rpitx: RF transmitter for Raspberry Pi which seemed like the way to go, it has alot of advanced features.
but I was running into alot of errors, and finally got it installed but commands run with no output! really confusing, and frustrating
FROM balenalib/rpi-raspbian:latest WORKDIR /usr/src/app RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y git cmake build-essential libgtk-3-dev libsdl2-dev zlib1g-dev liblua5.3-dev libgif-dev libsndfile1-dev libsoxr-dev RUN git clone https://github.com/Miegl/PiFmAdv.git WORKDIR /usr/src/app/PiFmAdv/src RUN make clean RUN make COPY . ./ CMD ["/bin/sh", "./pi_fm_adv"]
pirateradio ./pi_fm_adv: 1: Syntax error: word unexpected (expecting ")")
lets see what happens when i run
darn! same issue… from google it says this might be a archeticture build issue
from google says it might help.
Failed to open /dev/mem, try checking permissions. - Forum - Raspberry Pi - element14 Community
version: '2' services: pirateradio: build: ./pirateradio expose: - "80" ->privileged: true
./pi_fm_adv --audio sound_22050.wav --freq 90.5
well its something, but its not great. im going to try another sound track from freesound.org
./pi_fm_adv --audio sound2.wav --freq 90.7
nope. somethings up. i think its
b) configuration of the program
c) adjusting the gpu_freq
found this article on setting
/mnt/boot/config.txt but doesnt say anything about
gpu_freq Advanced boot settings - Balena Documentation
Raspberry Pi Documentation - The config.txt file
the fin rebooted automatically
which sends data to the api endpoint
/v1/morse to be piped to a filepipe that will send that audio data out the fm transmitter code
should be a simple fix
from app.run( debug=True, port=7878) to app.run(host='0.0.0.0', debug=True, port=7878)
nope. something else is going on
- computer is on a different subnet
- port 80/7878 are not exposed to outside world
- maybe i dont understand app.run(host=‘0.0.0.0’…) and it doesnt actually allow outside connections
from this stackoverflow makes me think: hmmmmm
What is the difference between docker-compose ports vs expose - Stack Overflow
going to try this
yeah i think its a port vs expose docker issue
shared_pipe is a data volume shared across two containers
heres how i map the shared folder
dockerizing a cool tool that does most of what I want. called
cwwav which takes stdin text and outputs a .wav file containing the beeps and boops of morse code.
- change base image from balenalib/rpi-raspbian:latest to -balenalib/-python:3-stretch-run because the install script required python3
turns out the issue with my dockerized
cwwav program was that it didnt have anything to do after being built. so it would eminently quit. this is not good for testing because i cant ssh into it.
these errors say to me that the data volume ‘shared_pipe’ is not mounted until when building the container
/bin/sh -c " find . -name 'morse_data.txt' | entr -r cwwav -f 400 -w 20 -o /usr/src/app/PiFmAdv/src/public/hello_world.wav /usr/src/app/PiFmAdv/src/public/morse_data.txt & /usr/src/app/PiFmAdv/src/pi_fm_adv --freq 90.7 --audio /usr/src/app/PiFmAdv/src/public/hello_world.wav"
this is two containers talking through one another using a file called morse_data.txt which is the message getting broadcast out the radio on repeat
im using a cool command called entr which watches for file changes within a directory and runs a command.
cwwav creates a audio file from the text within the morse_data.txt, the audio file is named hello_world.wav
pi_fm_adv is the radio tranmitter code, and reads the file called hello_world.wav and sends it over fm radio!
pictured here is the interaction between the two docker containers. the interupted pattern is when data is written to morse_data.txt. the api will eventurally write to that file as a means to send fm morse code. cool right?
ERROR: Could not allocate memory.
I added the feature where you can configure the radio station frequency by using some environment variables (device variables in balena speak)
more information about setting env variables Variables - Balena Documentation
It might be a issue where the PiFmAdv doesnt exit properily and locks the system in a weird state of limbo. the result is the fm fm radio exe doesnt restart but gives off
ERROR: Could not allocate memory. error
im going to give PiFmAdv --wait 0 (instead of --wait 1 the default) a try which according to the docs
--wait specifies whether PiFmAdv should wait for the the audio pipe or terminate as soon as there is no audio. It's set to 1 by default.
I think i figured out the issue with i was running into with the
ERROR: Could not allocate memory. error. there was two copies of PiFmAdv trying to run at the same time, which caused the error.
I’m experimenting with converting the start.sh file from write file read file, to pipes as recommended by @ramirogm
Also a suggestion by @ramirogm was to give local mode a shot! it was taking 5 mins to make just 1 change to populate on my device
fix: install from here Download Bonjour Print Services for Windows v2.0.2
PS local mode has livepush mode! with does heavy caching and auto reloads stuff! nice!
according to brave search .wav does not support file pipes! darn.
c - Audio file format that can be written without seeking - Stack Overflow
but this post does say that au is supported
- Still working on getting morse to work. should be out soon!