I’m Dr Sheldon Cooper and welcome to another exciting episode of Fun With Flags. We, humor aside, trying to get an accurate time on a micro can be done a multitude of ways and I have given them all a crack this time around and will use 2 out of 3 in my latest project.
So being WiFi enabled, i can call the time of an NTP time server, get the Unix time, do some math wizardry to make the time usable and bing bang boom you have the time. Trouble is, i was getting a number of failed packets and this is of course bad and was making my time keeping go off. Even if i was detecting fail packets and polling again for a new packet, it could wreck my other data and put things off. So, it had to go.
Of course you can call the millis function and do your own time, and I do this for some of the other non critical timing functions, like do this every 5 minutes or do this every 10 minutes, where if the clock drifts by a few seconds its not all that critical. I did make a functioning clock this way and I was getting about 2 seconds drift per day, easy enough to correct for but the code was ugly and you had to reset the time and date everytime i rebooted, and for testing it was a pain in the arse.
So i busted out a real time clock and connected her up and of course this is always going to be a superior option and the one i should have went straight for rather than stuffing about for a couple of nights giving each of the other guys a crack. Oh well, I learned a whole lot in the process and now she is a choocker. Oh and BTW, there are a number of different RTC modules on the market, one works off the SPI bus and the other off the I2C bus, well I have both and I never really liked the SPI RCT Clocks, and much prefer the I2C clocks like the DS3231. The SPI clocks I have seem to forget the time, or some random pulse resets the time. Do not know what is the cause, but I ended up ordering more I2C clocks and binning the others.
So i have been trying to get this thing to play nice with the Arduino IDE. Its certainly not for the feint of heart and the thinned of skin as it will take some work and a lot of trouble shooting to get this nightmare to run and play nice.
Out of the box the board will not program via USB as the bootloader on the board is basic and requires an external UART programmer like the ST-Link V2. I do now have an ST-Link V2 but have one on the way from an ebay seller, but in the mean time i wanted to play with the micro and see how it performs.
So, with a serial programmer in hand and the 4 wires soldered in I burned a new bootloader that allows the board to be programmed via USB, then stuffed about with drivers to get ones that work and eventually uploaded the blink program and got it working.
The STM32F103 boards have a 72Mhz processor, 64K of Flash and 20K of Ram and a metric ton of interupts. Plenty of resources for everyday Joe’s like me.
Oh, and what ham radio project/s am i going to use this for? Well, you will just have to wait and see. I won’t be providing a full description of how to get these things setup and working either. If you really really really want to do it, you are just going to have to suck it up and do what I did. Spend 2 hours working out each and every problem along the way. Its not as simple as just plugging in your arduino uno board and hitting upload and I have no desire to answer 1000 questions on why something is not working, because what worked for me, might not work for you as it will depend on what tools you are using to make it happen.
So i was sitting here thinking about adding CW to the Bitx 4om. Now there are a number of ways to achieve this from unbalancing the mixer to tone injection. Tone injection seems like the easiest option for me currently and so I started to give some thought to where I am going to get my 600hz tone from.
Well, as I am already working on an Iambic keyer using an arduino, it seemed like the best place to start. It also turns out that this is also a very simple option as well as it really is just 1 line of code to turn a pin on and produce a square wave at the desired frequency with a 50% duty cycle.
And with some massive attenuation and some RC filtering, i should be able to turn this square somewhat sine and make it even sound nice.
tone (8, 600);
Can it get more simple than that.
A couple of quick video’s showing both the memory and keying functions working. Now i just need to build the circuit for keying the buffer on and off and put that arduino IC onto a board. Won’t be long and I will be designing a PA.
Ok, with my arduino woes out of the way, i can now focus on the transmitter part of the 3 band CW rig project. Cannot rush these things and i might even get this rig working before i die, well we all have goals to shot for. LOL.
So what do I need and how are we going to go about it. For a start I am a paddle guy, single lever paddle to be precise so I need some form of built in electronic keying. A fixed speed is all i need, say 15wpm, most of the people I work from parks are slower cw types so 15wpm is a nice speed. Memory keying would be nice as I will be using the rig mostly for WWFF or SOTA a basic CQ macro and CQ Sota and CQ WWFF are all i need build in. It needs to provide the sidetone and finally this needs to be able to key the transmitter on and off as well.
As far as arduino keyers go, the Arduino CW Keyer by K3NG is probably the duck nuts. Fully feature rich and does everything other than be the other half of your contact. I looked at it, tested it and its bloody awesome, but i really do not need all that complexity so I have decided to roll my own.
So i assembled some bits and bobs and started to write some code. I have it sending nice perfect 15wpm code already using the Piezo as the speaker. I probably will not release this code. I think if you want a full fledged keyer use the one by K3NG and if you are like me and just need a simple keyer for your project, then its time to man up and write some code. It is really not that difficult at all.