8Mhz Signal From Arduino

So you might be thinking, Bullshit, you cannot get an 8mhz pwm signal out of an arduino. But you can. Ignoring the sine like shape of the waveform below for a minute, that is the actual PWM output from an arduino uno I was using to do this. So, why is it so.

Well, all you have to do is use some code wizardry using interrupts, timers and registers in such a way that the maximum pwm frequency you can get from most microcontrollers is 50% of the clock speed. Given that the arduino usually has a clock speed of 16mhz, this gives an actual maximum pwm out of 8mhz. And while this is nice, in practice it is not all that useful as the discrete numbers of frequencies that can be derived this way is not all that useful.

The code is below, I did not write this code and sorry to whomever did, I do not have a link back to it and your name was not included in the snippet, so i cannot credit you. Enjoy.

 

 

 

Facebooktwittergoogle_plusredditpinterestlinkedin

2016 CQWW

Now only if i paid attention to my logging, I would have been number 1 in OC. I lost so many points by typos. Multipliers for Russia and Westurn Australia as an example were lost because my logging program put the contacts in the wrong zone. Oh well, i only do this for a bit of fun and not seriously. It was heaps of fun though doing this contest QRP.

Facebooktwittergoogle_plusredditpinterestlinkedin

Arduino Memory Keyer

Ok, so it looks like a mess on the breadboard, and you would be right, its a bloody mess and there is so much other left over other projects that it is almost impossible to tell where the crap ends and the keyer begins, but i can assure you, its there and it works. I used the morse library written by Erik Linder SM0RVV and Mark VandeWettering K6HX and fixed by Glen Popiel which can be gotten from his website here: With a minor change to the header file in the library to make 2 private methods public, we are now able to individually key dits and dahs at the correct speed without delay overheads.

Connecting the key to the arduino is as simple as using 2 10K resistors in series to 5v to pull things high. And when you key a dit or dah things get pulled low, we read that change on pins 10 and 11 and send the dit and dah accordingly. Very much how PA3CHM did it here: in his simple keyer.

And because the morse library takes care of timing and can send strings of morse characters, it was a rather prospect to add in a 4 button keypad, fiddle with the example code in arduino and get some memory functions happening. So i have 2 hard coded memory calls, which call cq for me. This could be expanded with a larger keypad but suits my needs. The other 2 buttons are used to set the cw keyer speed, incrementing or decrementing the speed 1 wpm at a time.

Now obviously there are some rather full blown arduino keyers out there that have all the bells and whistles you can imagine, and yes i could have used the code by K3NG here: but i chose to roll my own specifically to my own needs and ultimately this will embedded in the 3 band cw rig i have been working on for sometime. The good thing is I have this part working, its timing is fine and now I can move onto the transmitter part of the project.

The code is published below, I hope others find it useful, take it, modify, expand and customise to your own needs. Enjoy.

 

 

Facebooktwittergoogle_plusredditpinterestlinkedin

So You Want To Make A Sine Wave In Arduino

So a bunch of blog posts back I posted how easy it was to get a square wave out of an arduino to do things with like generate your 600hz tone for CW etc. But we can go 1 further than that and use the arduino to generate sine waves. Of course you can filter the crap out of a 600hz square wave and make a sine, but to be honest, who really wants to wind inductors in the mH range or for that matter build a suitable LC filter to cut out the harmonics sufficiently to make a sine wave. But alas poor Yorick, there is a way and its called PWM.

 

So above we have a 31khz pwm signal that is being used to generate a sine wave. Through the wonders of mathematics and other nerd endeavours that PWM signal can be used to make sine waves, in my case a 600hz sine wave. Now obviously you still need to filter off the crap to see the sine wave, but its there and below is the filtered output. Now the good thing is you can filter with RC filters and make life simple. In my case i am using a 2 pole RC filter using 100nf caps and 2K resistors, and as you can see it looks rather sinusoidal.

So the following software is not mine, its something i found on the net and did some simple modifications to make work with an arduino UNO. Output is from PIN 11. Take a read, you should be able to work out how it works, using interrupts and timers to get some semblance of accuracy. Anyway, enjoy and have fun.

So I have cleaned up the original code to make it easier to read and to remove the stuff in there that was really doing nothing. And here is a link back to the original article. http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-dds-sinewave-generator/

Facebooktwittergoogle_plusredditpinterestlinkedin

Wemos WiFi and Fun With Clocks

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.

Facebooktwittergoogle_plusredditpinterestlinkedin

Wemos D1

Not to be outdone on micro controller usage, I am onto yet another micro that is worth using. I cannot see any real use for say ham radio, but for some other electronics projects i have been tinkering with for way to long, this might just be the go. The Wemos D1 is a uno compatible board that has 1meg flash, 80K ram, 80mhz processor and best of all WIFI, which means i can use this as a webserver for the weather station i have been planning/tinkering/building or procrastinating about for way to long. So with the addition of my other code and the hooking up of some sensors, I should be able to make this thing chooch and display the data on the world wide interwebs.

Facebooktwittergoogle_plusredditpinterestlinkedin

Going Light Weight

Well its the pigeon pair. I got the matching tuner to go with the HB-1B. The plan is to use it with a SotaBeams 10m pole and vertical wire and a couple of radials with the HB-1B and the Bitx 40 in some of the more space limited places I wish to operate from. I have everything here to acheive this, its just a matter of going down the local park with the laptop and antenna analyser and the rigs and getting things all sorted out.

Facebooktwittergoogle_plusredditpinterestlinkedin

STM32F103 Using Arduino IDE

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.

Facebooktwittergoogle_plusredditpinterestlinkedin