Luckily Python has all these text conversion functions built in (you don’t even need to roll your own lookup tables!)
Python3 code is below…
also available at this Gitlab link
Control the Arduino pager TX via Python running on a Linux machine
Update: Newer versions of this radio sold on Amazon are now supplied with a desk charger with a USB plug; it seems Baofeng have been monitoring the various comments from European users (and their modifications to the chargers) widely posted on blogs and social media (fair play to them!)
This is of course much safer and can also be used with any suitable USB power supply including cigarette lighter adapters for vehicles, but there are still a fair few units being sold with the mains powered desktop charger as well as many others in regular use worldwide.
You can also get better 6 unit chargers from HongKong which have a separate low voltage PSU (similar in size to a laptop charger) that connects to the desktop unit but in the meantime I investigated and modified one of the chargers I already have to make it slightly safer – a fiddly and awkward job due to the way this cheap charger is constructed.
ATTENTION: Don’t try this unless you are confident with working on mains voltage equipment!
Below are some pictures showing whats inside, a very simplified explanation of how this kind of charger works and why changing the cable is a good idea (I also used a better plug with a 5A fuse). The good news is that it all worked when I put the case back together (I definitely wasn’t going to attempt testing it with the live PCB exposed), and the output voltage at the terminals was correct (compared with that of an identical unit)
C Code to test the thermal printer and serial comms
The statue of the Blessed Virgin Mary also reminds me to take care with the metal box as its a 230V to 12V psu where I mislaid the case screws, there is 230V mains on terminals inside it)
This cat is the ringleader, but he shares the space with around 5 others and seems to even encourage them to visit my garden…
One bonus of this arrangement is if I see a cat I can sometimes then photograph it with a better camera (the kitties are often surprised that I seem to know where they are )
Interestingly they seem to behave better since the CCTV was installed; they do not fight each other and make noise with miauwing at night nor foul this side of the garden.
It is not just cats either I see on the camera…
Apologies for poor quality but that is a hedgehog. Apparently these are getting rare in some bits of England so I reported the sighting to Suffolk Wildlife Trust who put it on their map. A lot of folk seem to feed hedgehogs with cat food, I wonder if they are actually following the cats around (they are too big and well protected for lazy town cats to bother with them as prey)…]]>
Unfortunately last year I had to deal with a family bereavement as well as health problems/tiredness/burnout; often after I have finished with work-related tasks (which I try and prioritise my energy towards as I am lucky to have a very understanding and accomodating employer) I am way too tired for much else, such as music/creative stuff such as photography and tech/electronic projects.
Also slowly realising I am getting older and have had to make some different lifestyle choices; much less partying and late nights compared to my nearly two decades as a raver, DJ, party promoter etc. All good fun but starting to get a bit much in the end.
This has slightly reduced my enthusiasm for “harder” electronic music, so I have temporarily removed the online radiostation VFR Europe from here (as I hadn’t got the time to curate, upload and schedule content, let alone work on my home studio) although it will hopefully return in the future.
For those who want music there is still plenty on www.partyvibe.com
The good news is I am slowly regaining energy as well as getting into a better routine of sleep patterns, eating etc than in my “youth” (I still don’t consider myself to be old!) and there are still things I get up to I can blog about so hope to be posting here more often.
I don’t do “social networks” much – I (re)tweet occasionally at @vfrmedia (when I get round to it will add the twitter sidebar) and have no desire to become a “social media star” so this blog isn’t going to contain the latest “hip” technology; but will reflect my diverse tech/engineering interests (including “retro” stuff such as my reignited interest in fountain pens) as well as nature/and environment related content….]]>
Since putting this project on Youtube I’ve had a surprising amount of interest from across the world about the modifications I made to the original code from ON1ARF ( a radioamateur in België) to allow 1200 and 2400 bps pager transmissions as well as the default 512bps (I wanted to use the circuit to test commercial POCSAG pager receivers used at one site at my work).
The original code is here
To get 1200 and 2400 bps you must alter the radiohead libraries it depends on.
Two files must change – the first is RH_RF22.cpp. The code snippet is below (cut and paste this into your editor)
header file for Arduino POCSAG RF22 tx
header file for Arduino POCSAG RF22 tx
Also the header file RH_RF22.h must change so the modemconfig table has values that reflect the changed modulation schemes.
the rest can then be used as normal – remember to alter the main Arduino sketch code to select these new bps rates.
NB: I am based in the UK/Europe; we always use wide deviation for POCSAG signals (although much other PMR traffic is now on narrow deviation).
If your country’s Communications Ministry requires narrow deviation to be used you will have to recalculate the modem settings using the spreadsheet referred to in the library files. (Its not as bad as it might seem; I had to use it to get the 1200/2400bps settings and I am not an RF nor a coding expert by any means)
As I had the assembler source, decided to experiment with altering the string data (I don’t yet know enough to do anything else).
it still worked
note how the addresses of the array pointer change, as the strings have grown by a few characters…
below is the original code
of course this is basic easy stuff; those strings are static/constant data and declared at compile time. if your code is dealing with strings that can change their length, it must always have sufficient free memory allocated to wherever the string data ends up, enough for the largest of the data. Otherwise you get a buffer overflow and your goose is cooked…]]>