Python on the Pi – My trail camera

My old Pi – Too slow as a desktop PC

I’ve had this old Pi for quite a few years now. It’s so slow that it can’t be used for much other than playing around with it but it’s ideal for the purpose of being a trail camera. I fitted the PiCam module and also a WiFi adapter. This model, unlike the latest models, was pretty much a bare bones computer.

So I did a little Python programming to talk to the camera module and just recently included a facility to send me a mail whenever a photo was taken.

In this case too, I use an external infrared movement detector which has a normally closed contact. The contact is wired between ground and pin 17 on the GPIO port. Contact bounce has been handled within the Python program. A simple solution with exciting possibilities.

Here is my latest Python code.

from picamera import PiCamera
from pygame import *

screen = display.set_mode ((640, 128))
display.set_caption ('Eds trail camera INITILIZED  - Press q to Quit')

import smtplib
import time
import RPi.GPIO as GPIO


camera = PiCamera()

stop = False
counter = 0

def my_callback(channel):
    snaptime = time.strftime('%A %d %b %Y %H:%M:%S')

    smtpUser = ''
    smtpPass = 'yourpassword'

    toAdd = ''
    fromAdd = smtpUser

    subject = snaptime
    header = 'To: ' + toAdd + '\n' + 'From: ' + fromAdd + '\n'+ 'Subject: '  + subject
    body = 'Eds trail camera was triggered through movement detection. '

    print header + '\n' + body

    s = smtplib.SMTP('', 587)


    s.sendmail(fromAdd, toAdd, header + '\n\n' + body)

    global counter

    # DEBOUNCE Code

    if (counter >= 10):
        counter = 0

        camera.annotate_text_size = 30
        camera.annotate_text = snaptime

        time.sleep(0.1)	    # Allow 100 ms for IR LED's to switch on (At night)
        camera.capture('/home/pi/snapshot_' + snaptime + '.jpg')

        print ('Camera was tiggered on ' + snaptime)

camera.rotation = 180


GPIO.add_event_detect(17, GPIO.RISING, callback = my_callback)

while (stop == False) :

   counter = counter + 1    # Allow for trigger contact bounce

   for e in event.get():
       if e.type == KEYDOWN:
           if (e.key == K_q):
               print ('Trail camera stopped')
               stop = True
               print('Press q to Quit')


Python on the Pi – Sending mail

Set to ON

I’m busy experimenting with the Rasberry Pi and doing a little Python programming. One of the goals I had was to be able to send an email for status messages.

First things first, make sure your Pi is up to date and upgraded to the latest versions

sudo apt-get update

sudo apt-get upgrade

When all is complete you need to do two installs

sudo apt-get ssmtp mailutils

Note the double s

Note on GMail you will need to open a new account and set it that non google applications be allowed to use it (Less secure). Note your privacy on this mail account shouldn’t be an issue.

Once your account is created and signed in on line, click on your profile icon, then click on “Manage your Google Account“. Click on “Security” and scroll down to “Less secure App access” and switch it ON. That’s it, now you’re ready to play!

Simple python code. Substitute your own mail addresses.

import smtplib

smtpUser = ''
smtpPass = 'yourpassword'

toAdd = ''
fromAdd = smtpUser

subject = 'Python mail send test'
header = 'To: ' + toAdd + '\n' + 'From: ' + fromAdd + '\n' + 'Subject: ' + subject
body = 'From within a Python script'

print header + '\n' + body

s = smtplib.SMTP('',587)    


s.login(smtpUser, smtpPass)
s.sendmail(fromAdd, toAdd, header + '\n\n' + body)


Works pretty well. Now to implement this facility in my home brew rasberry pi based trail camera!

ZS6BNE – My Morse Code (CW) Journey

My good friend Mike ZS6MSW, promoter for CW in South Africa, asked for stories like this. This is my story, a forty six year old story.

I was in high school and discovered ham radio through listening on a valve shortwave radio to the South African Radio League’s weekly bulletin transmitted on Sunday mornings using the AM mode.

I joined the SARL, did a nighttime RAE course and wrote the written technical and regulatory exam in November 1974. Morse code was compulsory then for a ZS licence. My younger brother helped me by drilling me constantly on the letters and numbers and their dot / dash equivalents. I bought a hand key but can’t recall what I used as a tone generator. I could send well and pretty fast too BUT the method of learning was not as it should be. I had no mentor. I took the 12 words per minute test at the post office in Johannesburg. I battled with the receiving side but passed. Having passed the RAE and the Morse code test I applied for my ZS licence and got it after swearing an oath of secrecy in February 1975. By then I was in standard nine.

My dad helped my buy my first transmitter, the Yaesu FL-DX400 and I had a second hand KW77 communications receiver. I actually lost my first CW QSO with a Rhodesian ham after he asked me to QSY to a different frequency, I wasn’t sure how to read the dial exactly! Working with a separate TX and RX made it even more difficult.

I had to complete a whole year on CW before being allowed to use SSB. That was a good thing of course. I had met up with a friend, John Smith ZS6BNS and we had regular QSO’s. John was at Wits university at the time. We became such good friends that we alternated having Sunday lunch at each other’s house most weekends.

I even had my station set up in the cupboard while in matric to make a hidden QSO now and then. I used my bedroom window frame as an antenna but of course the transmitter wasn’t happy with that and I destroyed the finals. I eventually gave the transmitter to Norman, ZS6ASL a technician that worked for the SABC if I recall correctly. Norman home brewed the most beautiful valve equipment. We lost touch over the years but John is still a good friend of mine and we still occasionally communicate via Facebook.

All school leavers in South Africa then had to do compulsory military training. I filled in the questionnaire and was glad to see questions like your ability to send and receive Morse code. I was convinced that my abilities would be used by the SADF when called up. I was called up to Kimberley One maintenance unit, nothing at all to do with radio or the Morse code. After basic training I was sent away to an ammunition depot and spent my days there packing ammunition boxes into storerooms the size of halls! Consignments to support the border war also needed to be packed regularly and sent off secretly.

Sometime I had purchased a FT101EE and was paying it off with my monthly army pay which wasn’t much at all. I took it with me to the depot and set up station there for weekends off time. I sometimes used the FT-101EE’s mic PTT button as a Morse code key and this impressed another soldier there who was a “doggy”. They stood guard at night walking with their dogs and R1 rifles. This soldier was Vincent who later became a ham and got the call sign ZS6BTY.

I happened to have a QSO with Brian Austin, ZS6BKW, famous for his BKW open wire fed antenna. Brian was a captain in the citizen force. Within a week he had me out of the ammunition depot and I became a signaler, a radio operator. Initially being called up for a year gave me six months being in signals, that six months became another eighteen months as legislation changed and everyone had to do two years national service.

After the army I went into the post office and trained as a telecom technician. I took my station to the Post Office college at Olifantsfontein where I stayed for three months at a time doing practical in between. I met up with a ham and his wife who lived close by and was often invited for supper. Hostel food was good but something different is always better.

In 1980 I met my wife and we were married later that year. I couldn’t get a transfer after qualifying as a technician so had to resign and in 1981 started work in Lichtenburg where I still stay now, with a cement company as an instrument technician. The workshop was well equipped for building PCB’s and it was here where I built an electronic keyer and a paddle using a hacksaw blade with perspex handle. I can’t recall whether I used a proven design or designed it myself. Logics (TTL / CMOS Gates) at tech was one of my main subjects. The keyer and paddle lasted me till way after 1995 – fifteen years later, together with the FT101EE I bought while in the army! I sold the keyer after buying an Icom IC-706mkiig which changed my ham radio world drastically. It of course had a built in keyer.

By the mid 1990’s I had done a career change away from a technical field and into computers doing systems programming and database administration on a mainframe system.

Many of our local ham radio club members wanted to upgrade to a ZS so I started giving Morse code lessons and after a few months many passed their morse code test. A few are my good friends Gert ZS6SMI, Dave ZS6DDU and Kobus ZS6RPJ. We lost some of our friends along the way R.I.P.

To be continued ……

RaDAR News – July 2020 challenge

Not everyone submits a log or report (It’s not a requirement) but here are a few highlights from around the world.

Greg N4KGK and Dennis WA6QKN

Dennis and I got in three stops and 15 contacts under some toasty sunshine at Opal Beach on Santa Rosa Island. Thirteen of those contacts were on 17 meters. Hearing 17 open and making contacts with ten watts and a magnetic loop was fun. It helped to spot ourselves on the Parks On The Air Site. The rig was an Icom 703, and the antenna was the Alexloop. That meant we had a light pack up for our one-kilometer walk between stops. There were a fair number of folks having fun on the Santa Rosa Sound beach. They were curious about our operations and seemed impressed. 

We worked Bud W3FF, a notable ham in California. Our best contact was stumbling upon Chris VA3ECO. He was doing RaDAR from his motorboat on the big lake where he lives on an island in Ontario. Chris winters here in Panama City Beach and is a member of Panama City ARC. So RaDAR outings are still a blast, and my bet that we could get by with lighter gear paid off even at the solar cycle minimum.This is a sign the high HF bands are on their way back

Chris VA3ECO’s You Tube video can be seen here

Chris VA3ECO

I managed 20 contacts at 4 locations, bonus points for some PSK31 and a RaDAR to RaDAR with Greg! I think my total is 90 points, for what it matters.
The ITU contest kind of mad 20 meters busy, so I took Greg’s advice and spent most of my time on 17 meters phone. I had quite a few long QSO’s, talking about RaDAR, antennas, and even one half hour chat about sailboats.
I’ve already sent you a link to my youtube video, but here it is again:

Andy DL2DVE/p

Heard recently about the RaDAR Challenge and wanted to give it a try.

·        Living in a small town (14k people) east of Munich in South Germany, we have a nice countryside close by – called “Schwabener Moos” – some forest / fields / meadows / grassland.

·        Starting from home, using bicycle for transportation, so minimum distance is 2km to each site

·        To find enough QSO-Partners, had initially the idea to combine it with GMA Activations, then I learned  the IARU HF Championship Contest runs in parallel

·        Using the IC-706 (100W) and the Diamond C-Whip antenna (~2m) – this set was created in 2006 for quick deployment of a SOTA-Activation Station, see:

·        Overall backpack weight: 8kg (incl. VX-6 for VHF/UHF FM and Garmin GPSmap64s)

Defined the following targets:

·        Wanted to find out how many sites can be activated within the 4 hours:

·        2km by bike should be possible within 10min.

·        The station set-up and 5 QSOs in Contest shall be possible within 20min.

·        So one cycle shall be done in 30min.

·        This would result in 8 deployments within the given 4 hours.


·        6 sites were deployed

·        It took almost 40min in average for one cycle

·        Reality vs. plan:

o   Moving: it took always a few additional minutes to find a suitable place to set-up the station.

o   Operating time: Even with 100W, my signal was too weak vs. competition in the contest, many stations did not copy me. Others with Beam + PA were much stronger, so it took in average 12min to complete the 5 QSOs.

o   Noting the 10 digit locator and taking a few photos per site also needs a bit time.

o   Certainly the time for deployment and disassembly can be more optimized in future.

·        Overall I’m somewhat satisfied with 6 deployments and one DX-Contact to Japan, resulting in 105 Points. 3x (6 x 5 +5).

It was Fun !

Where will you publish the results?  Even it is non-competitive, I’m interested in the activities of the others.

Kobus ZS6BOS 

My RaDAR Challenge in cold weather went well. This time I used my bakkie to do the challenge and combined it with a sota on ZS/GP-019 Jagfontein as the 3rd and final location. Left my QTH at 09h40 utc and stopped transmitting at 13h40 utc.Did the challenge on 70cm, but tried some 40m at the Sota peak. Was rather disappointing with only three hf contacts. Made a nice 70cm contact to Bethlehem. It was very windy and cold. Could not get the yagi up at the last location, but luckily I had a J-pole as a backup. 
Completely forgot to take photos. I think it was the wind and cold and the problem of getting the antenna up. Maybe next time……


Had a great day out despite the weather.  I put a little effort into making a video.  I was on foot and made 39 contacts, although I only would get credit for 15, as I was only at 3 locations, but I had some pile-ups and didn’t want to cut people off.

Enjoy the video :


A difficult day for the challenge with the IARU contest.  Also I had family visiting under the Covid19, lockdown “bubble”arrangements.  Following test on Friday I decided to operate for a couple of hours in the morning on 40m before the start of the contest at 12:00 UTC.  This would give me time to be back home before my visitors arrived.  I also planned to operate on 17m in the late afternoon to try to give a RaDAR to RaDAR QSO to  operators in N. America.

So, was at my first station at about 07:30 UTC. After about an hour I had my five QSOs and made my way on foot to station 2, one kilometre away.  Here I managed four QSOS before deciding to head back home to meet my guests.  Actually thought I had made 5 QSOs – clerical error!.

I got home a few minutes after the guests arrived.

My experience on 40m was mixed.  There was  lots of European  activity.  Many  QRO + nets and long chatty QSOs going on.  My QRP SSB CQ calls  did not attract any takers.  I found the best qso chances with Flora and Fauna stations.

I did venture out for an hour late afternoon to see if I could work any RaDAR stations on 17m.  17m was very flat – no intercontinental stations whatsoever and only two or three audible European stations.  I had QSOs with two of them.  They gave me surprisingly good signal reports in view of my 10W to a 3 metre vertical backpack mounted antenna.

Eddie ZS6BNE

Today was International RaDAR day …….. The CuddeBack trail camera was my photographer.

All contacts were via satellite. I tried some QRPp HF CW at the end to no avail.

Point 1 – Grid KG34ac19do Worked ZS4CGR, ZR6LJK, ZS6EMS, ZS1TA and ZS5AYC another RaDAR station in grid KF58cwo8gw80 via the AO-92 cubesat.

Point 2 – Grid KG34ac19eo Worked ZS4CGR, ZS5AYC and ZS5APT in grid KF58cw03bu56, FR5PF on Reunion island (He battled to make out my call sign even phonetically) and ZR6LJK via the AO-91 cubesat.

Point 3 – Grid KG34ac19el Worked ZS2BK and ZR6LJK via PO-101, ZS2BK and ZR6LJK via SO-50.


Sid ZS5AYC and Adele ZS5APT

Saturday was a FUN day, although the weather forecast for the South Coast was supposed to be a sunny day, we woke up to dark skies with a promise of rain, we had decided to combine the RaDAR challenge with activating the Umtamvuna Nature Reserve ZSFF-0405 in Port Edward.

However when we arrived there the gates were locked. We backtracked to Clearwater’s hiking trails and had just enough time to set up for AO-92 satellite,

Point 1: Grid KF58CW08GW80.

Sid worked ZR6LJK, ZS6BNE, ZS4CGR and ZS1TA but missed ZS1OB for the log via the AO-92 CubeSat. We quickly set up the portable station made another 3 contacts, ZS4CGR, ZS4MG and ZS5QI.

Point 2: Grid KF58CW08BU56

We set off for the viewing deck, but as it was only 400m, we walked the trail to left of the viewing deck, returning to the viewing deck and then still needed to walked another 300 m to complete the 1 km required, we had 2 minutes to get ready for the AO-91 CubeSat Sid worked, ZS2BK, ZS4CGR and ZS6BNE, once again we had to set up the portable station to complete the required 5 contacts, logging ZS4CGR, ZS4MG and ZS6AKW.

We walked back to the UTE where we first enjoyed a hot cup of coffee and rusks.

Point 3: Grid KF59CA21HI93

We drove 6 km and set up station, working ZS4CGR, ZS4MG, ZS6BRB, ZS5QI and ZS6PRO, band conditions were not good and reports were 5.1

RaDAR Challenge – July 2020

Lock down Level 3 (Relaxed, but not yet level 2) – A HUNDRED and SEVEN DAYS! (FIFTEEN WEEKS + ) of an unknown length of time : Saturday 11th of July 2020.

Today was International RaDAR day …….. The CuddeBack trail camera was my photographer.

All contacts were via satellite. I tried some QRPp HF CW at the end to no avail.

Point 1 – Grid KG34ac19do Worked ZS4CGR, ZR6LJK, ZS6EMS, ZS1TA and ZS5AYC another RaDAR station in grid KF58cwo8gw80 via the AO-92 cubesat.

Point 2 – Grid KG34ac19eo Worked ZS4CGR, ZS5AYC and ZS5APT in grid KF58cw03bu56, FR5PF on Reunion island (He battled to make out my call sign even phonetically) and ZR6LJK via the AO-91 cubesat.

Point 3 – Grid KG34ac19el Worked ZS2BK and ZR6LJK via PO-101, ZS2BK and ZR6LJK via SO-50.


A successful RaDAR Challenge,

RaDAR Challenge – Defining your four hours

My satellite pass list

We all live in different parts of the world. The choice of four hours within the twenty four hour time frame is each operator’s own choice, what suits him / her best. Synchronizing these times can be done with others via forums and social media ahead of the challenge. Like planning an ops, a RaDAR ops.

For example I have chosen my four hours to start at 10:00 local time and to finish at 14:00. For me it’s easy, I need to coincide with the FM satellite pass times for my grid location.

I will start walking to my first location starting at 10:00 local time and deploy my SatComms station to be ready at 10:23 when the AO-92 cubesat comes over the horizon. I’ll print this info and keep it in my “RaDAR Signals Instruction” folder, because the app, ISS Detector, likes to be in contact with the Internet and if not prediction info could fail! Because I walk I’m classified in this instance to be a moving RaDAR station, “on foot”.

If I started and communicated from home, I’d be a fixed station. If I started and communicated from a camping area I’d be a portable station. These deployments can be mixed. For example after the five portable QSO’s you could ride a bicycle for two kilometers to the next deployment point and classifed, in this instance, as a moving RaDAR station.

The ISS is in the list. One could play APRS if any SatGates are within the footprint. That could possibly count as a contact. Digipeating via the ISS using packet radio and communicating with someone would definitely win you some “Points”. I’m not sure if the ISS’s BBS RS0ISS-11 is active anymore?

I would have a whole hour to walk and deploy at the next position before the AO-91 cubesat will come into range. Well that is if I made five QSO’s on the previous satellite otherwise I’d need to stay put! Tough if that happens. It worked for me in April, I hope this time round it goes as well. Having HF facilities could certainly fill in the gaps.

For the next session I’ll have over an hour for the next deployment if all goes well up to this point. In the meantime I’d enjoy the bush and nature in general. PO-101 is a tricky satellite to work having a 70cm uplink and VERY sensitive to doppler. My TH-D7A(g) can only move in 5 kHz steps.

PO-101 overlaps slightly with the times for SO-50. I could switch between the two but I’d have a better chance with SO-50 which is also a tricky bird. Luckily it has a 70cm downlink so doppler settings are easier.

I work full duplex on the TH-D7A(g) using the SA-AMSAT antenna design mounted on a tripod. I use a 12 v 7 A/Hr SLAB to power the system so I’ve always got a decent 5W on the uplink. I use a remote mic and headphones, the left and right speakers wired in parallel so I can hear properly using both ears.

I write all the info down by hand on my RaDAR logsheet with the satellite info printed on a separate sheet of paper, all stored in the RaDAR Signal Instruction folder.

From then on I have forty five minutes to pack up and walk back home. If all works out as it should with the necessary support from other hams, it will be a successful ops.

Oh, I carry a Lensatic magnetic compass so I can determine true north. Then I place my smartphone or paper image on the ground under the tripod so I can follow the satellites movement reasonably accurately throughout the pass from horizon to horizon.

My FT-817ND needs another finals replacement so HF is out for me presently. Ordering could be problematic as the postal system has come to a standstill here in South Africa since the lock down started over three months ago.

Hoping all are surviving the COVID-19 pandemic. Here in South Africa the infection rate is climbing rapidly.

Stay safe and have fun. Looking forward to hearing all the stories in blogs and You Tube videos.

73 de Eddie ZS6BNE