Overclocking the Arduino. UNO & MEGA.

Windows 10 Pro. Panasonic CF-C1 laptop. Arduino 1.8.2. Arduino 1.0.5-r2.

Having the need for a faster processor in order to speed up my touchscreen TFT response, I wondered if it was possible to make the Arduino Mega run with a faster crystal.

Short answer, Yes ! But first …….

A faster UNO.
Imagine my surprise when I discovered that overclocking the Arduino is quite popular. Since I have a spare UNO, and it has a ‘thro hole’ crystal, I decided to experiment with that. This type of Arduino build is the easiest to modify as will become apparent.
I removed the crystal and fitted a 3 pin socket with the centre pin removed. This gives the correct spacing for a HC-49 size crystal can. Experimenting with a couple of odd crystals that I have, I discovered, with some surprise, that the Uno will work OK, up to 28.224MHz. ( this frequency produces meaningful baud rates with integer division) This is the highest frequency fundamental crystal that I have. The crystal needs to be a fundamental type, as the Arduino internal oscillator will not function correctly with an overtone crystal, such as a 27MHz RC type. Which are 9MHz, 3rd harmonic. It will more than likely oscillate at 1/3rd of the Marked frequency. Also, if your UNO has a ceramic resonator ( much more difficult, but not impossible to work with ) you will need to add a ceramic capacitor of 22pF, from each crystal leg to ground. The can type crystal will have these on the Arduino board already.
Arduino IDE Serial monitor is compromised due to the incorrect clock frequency in relation to the baud rate. This can be resolved by editing the ‘boards.txt’ file in the Arduino\hardware\arduino path. Find the entry for UNO. You need to change the build.f_CPU= 16000000L to whatever value your crystal is, 282240000L in my case. Alternatively, create a complete new entry with a unique name, such as ‘Uno_28MHz’. Just cut, paste and edit the existing Uno entry. Rename every parameter including the name entry. The new ‘board’ will appear in the Arduino IDE under the TOOLS menu drop down, after restarting the IDE.
Sketch transfer still needs to be at the original 16MHz, ( hence the socket ) using the original 16MHz UNO board selection and correct COM port. I found this to work without any problems, other than the inconvenience of changing the crystal too often.
Ultimately the sketch can be developed at 16MHz, and the crystal and board selection finally changed when debugging is complete. Then the sketch can be uploaded with the new setup.
The 28.224 MHz crystal experiment would not work in the MEGA !

External Oscillator.
An external ‘canned’ oscillator can also be used as the clock source, but the Arduino ‘fuses’ will need to be programmed in order to tell the processor which clock source to use. The Arduino CANNOT modify its own fuses via the IDE. This will need to be done using an ISP device and a program such as AVRDUDE.EXE. This is not the friendliest utility and a quick search of the internet produced a GUI version called AVRDUDESS, which I find so much easier to use, rather than the command line version.
Download it here ….
http://blog.zakkemble.co.uk/avrdudess-a-gui-for-avrdude/
Install the software and place a copy of libusb0.dll into the same folder. This dll file is buried inside the Arduino installation.
On my laptop this is at C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\

The MEGA.
I had already carefully removed the ceramic resonator from a MEGA clone and fitted a 28MHz crystal and capacitors, I later replaced the crystal with a 22MHz oscillator module. The output of the module connects to Xtal1 on the Atmega 2560 chip. This is the solder pad nearest the Mega I/O terminal strip, and furthest from the chip itself. It is powered from the 5v and GND connections on the Mega that are conveniently nearby.
Not having an ISP programmer I constructed a simple device using an Arduino Pro Mini, running the ArduinoISP sketch that is found in the Arduino EXAMPLES folder. The processor needs to be at least a 328. A UNO or NANO with 328p processor would be suitable of course.
See my previous post for details of a NANO version. The diagram shows the recommended circuit and the connections from the NANO to the Mega, as an example. The LED wiring was the most complicated part of that project.
After uploading the ArduinoISP sketch in the normal way, a 10uF at 10v or more capacitor needs to be fitted between RESET and GND, this prevents the processor from being reset when used as a programmer for the UNO or Mega, or any other device you choose.

Fuses.
The processor fuses that we are interested in are labeled lfuse and hfuse. Meaning low fuse and high fuse. The lfuse contains the bits that need to be changed in order to select the external oscillator as the clock source. The default value appears to be 0xFF. The lower 4 bits and bits 6 and 7, need to be programmed to 0. (The logic is inverted. See the datasheets for more info ) The new value is 0xA0. 1010 0000 in binary. The hfuse is 0xD8 by default and needs no changes.

Caution
Do not change any of the other values, it is possible to easily ‘brick, your device. Only a HV programmer can fix this unwanted situation. Beyond the scope of this article.

AVRDUDESS.
Connect up the devices and connect the programming board to the PC USB port. Check the COM port number of the ISP in the Arduino ISP TOOLS>PORT.
Using Windows explorer, navigate to the AVRDUDESS install folder and launch the application. In the Programmer drop down, select Arduino as the programming interface. Select the correct COM port from its drop down. Type in the baud rate, 19200 is the default for the ISP. At the top righthand side select the MEGA2560 in the 2 device boxes. This is sufficient information for avrdudess to read your device settings. Click on READ fuses. The program responds in the DOS window, and updates the fuse readings in the GUI. Clicking on CONFIG will allow you to see the individual fuse settings in bit patterns. They can be modified in this screen.
The default hfuse bit pattern is 110110001 = 0xD8
The NEW lfuse bit pattern is 10100000 = 0xC0
Exit the screen. Then write to the device by clicking WRITE in the fuses section.
Avrdudess reports the changes. Clicking on SAVE will remember your settings.

A NEW board.
Create a new MEGA entry in the boards.txt file with a unique name, such as Mega_22. Copy one of the existing entries and edit it. Change the lfuse and hfuse values. Change the build.f_CPU frequency as detailed previously. Save the changes. On restarting the IDE the new board appears in the TOOLS/BOARD drop down. Select it. Select the COM port of the ISP device. The Mega can now be programmed from the Arduino IDE, using the ISP programmer. The crystal does not control the baud rate of the ISP which is fixed at 19200 baud. Connect your newly programmed board to the USB port, and select the correct device and port inside the Arduino IDE TOOLS menu. The IDE serial monitor should work correctly due to the new crystal information in the boards.txt file. You will always need to use the ISP device for programming unless you modify the bootloader. I have not yet managed to do this with the MEGA, but the UNO was a different story………..

UNO Optiboot Bootloader.
In order to be able to program the faster UNO directly from the IDE, without a programmer, the boot loader files will need to be edited to reflect the new oscillator frequency. Then the MAKEFILE will have to be compiled with MAKE to produce a new boot loader hex file. This is straightforward as long as you get all the details correct. It can stretch your patience a little !!

MAKE is not shipped with the latest versions of Arduino. You will need an earlier version such as Arduino-1.0.5-r2, which is still available for download. Unzip this to a separate folder e.g. C:\ArduinoOld. Navigate to the \bootloaders directory and open the \optiboot sub-directory. Open “makefile” in a text editor. Similar to the boards.txt file, make a new entry in this makefile reflecting the changes to CPU speed. Give it a unique name as before, such as FastUNO. You will need a unique name for the bootloader that will be produced, such as FastUNO328.hex. Edit the entry and save the changes. If you have problems here see the footnote on permissions.

Open the Windows command line as Administrator. Failure to do this will probably result in the ‘access denied’ error message. Navigate to the directory which holds the edited makefile. The DOS command is CD ‘path’. Start with CD C:\ this gets you to the root. You can find the Arduino directory in Windows Explorer and copy the path from the Windows address bar, then CTRL v to paste it into the DOS window at the root prompt, usually C:\ >
The Windows batch file, “omake.bat” MUST be in the same folder as the “makefile” that you edited previously.
The MAKE command line entry MUST use the unique name you chose earlier. Such as “omake FastUNO” Any failures are probably due to the wrong path or privileges. I had to edit the omake.bat file to point directly to the make.exe location, which resides at C:\ArduinoOld\hardware\tools\avr\utils\make . Alternatively if you are sufficiently familiar with Windows environment variables, you can create a new path entry. Beyond my scope, but take a look here…. https://www.computerhope.com/issues/ch000549.htm
At the command prompt, try OMAKE -v. This will force MAKE to supply its version number, and confirm it is available, similarly avr-gcc –version will report the version number of the compiler.
Any error messages will be due to incorrect path or privileges. On successful completion of the OMAKE FASTUNO command, you should find the following 2 files in the bootloaders\optiboot folder.
FastUNO328.hex
FastUNO328.lst.
Copy these to the \optiboot folder in your current Arduino installation. Launch AVRDUDESS again, Avrdudess can now be used to install FastUNO.hex as the new boot loader, by searching your local drive from within the avrdudess FLASH search bar.
This process has no affect on your current Arduino installation. Although I experienced some problems with the paths in omake.bat and in makefile, due to the Arduino file structure changes,  and the whole process is a bit long-winded, it all worked properly once the details were correct. Optiboot will NOT work on the MEGA due to the different addressing requirements.

Permissions in Arduino.
The Arduino installation protects its files by making them accessible only to special security privileges. Ensure you are logged in as Administrator. Open an Arduino ‘H’ file in Windows Notepad for example. After editing the file, you cannot save the changes because the file is write protected, even tho you are logged in as Admin. To get around this, open Windows Explorer and navigate to the Arduino installation. Right click on the Arduino folder, go to Properties, and select Security. In the GROUP box, select Users(computer)\Users. Then click EDIT. This pops up another GROUP box, click Users etc. then in the Permissions box tick the top 2 checkboxes, Full Control and Modify. Click Apply. Windows will scroll thro the Arduino directory entry applying the permissions. Click OK on any open pop-ups. You can now edit Arduino files with any suitable text editor and save your changes. I find Notepad ++ to be very useful.

Conclusion.

You should now be able to create faster Arduino’s  for the price of a crystal or oscillator module. I’m an electronics hardware guy, not a programmer, so forgive the long and winding explanation. It has taken me at least a month of research to get this far. I really hope there are no errors and someone else finds this helpful.

I searched the forums as usual, only to find misleading info, typos and outright mis-information. One reply to a query on the Mega was a suggestion to “read the datasheet” all 435 pages of tables and equations. Another reply, and I quote ” you can’t do it like that. “, very constructive. One “Instructable” that I found had 3 incorrect steps, which I discovered the hard way.  How can anyone learn from that ?

Will ZL4SAE

Arduino NANO as ISP ( programmer )

I recently did some experiments with overclocking an Arduino UNO. One important piece of kit that is required is a programmer. These are available from a number of outlets, but I don’t like spending money on something that I can make for myself.  I have a number of smaller Arduino boards such as the Pro Mini and the NANO. I decided to use one of these as the ISP device.

I succeeded in my quest to overclock the UNO at over 28MHz. More details on that soon.

ArduinoISP      PDF Download

Negative voltage generator using 555

Negative voltage generator.
I originally designed this circuit in order to repair an Icom 701. It is a fairly standard application of the ubiquitous 555 chip. The output is dependant on the supply voltage and the load, you will not get -9v out with 10v in for example. There is no such thing as a free lunch, and the diodes drop some volts. Replacing silicon diodes with Schottky types will improve things a little.  With a bit of imagination it can be constructed in a very small volume. 

The available current is quite small, about 20mA maximum into a 500R load. Efficiency around 30%. If I recall correctly, the 701 needed just a few uA, so well within the capability of this circuit.

Having recently purchased an SSB i/f PCB that needs -ve volts on the mixers and op-amps, I searched my notebook for
the schematic and made an electronic copy on my Samsung tablet, using the amazing app, SCHEMATIC.

KVN 3 Filter PCB. AM and SSB Receiver. Telrad.

This is a work in progress., and some progress has been made

Due to information from the Yahoo group and others (see below) I have updated some capacitor values, and added a capacitor that I omitted. There was a resistor missing from the original drawing that I worked from, this has been corrected. I have added the test-point numbers, and a couple of notes about the audio filter.

I purchased this board from eBay. The vendor was based in Israel. At $37 NZ I considered it to be good value, as the circuit included 3 Crystal filters and 3 mixers. Searching Google produced so little information I was concerned that I would have to reverse engineer the board in order to produce a schematic. I eventually found a German language site ( forgotten the address ) with a link to a drawing. It appears to have been done in Eagle Lite. There were no component numbers or values. Some reverse engineering was going to be needed after all.

fullsizerender

I spent some considerable time working my way through the circuit and identifying the component values. I sincerely hope that there are not too many mistakes. The drawing would be very cluttered if the part numbers were included, so I have omitted them, except for the values around the LPF. A couple of the transistors were oriented wrongly in the drawing, I have corrected them in my schematic. I have also separated the AGC and the AUDIO modules from the rest of the circuit, along with the voltage regulator. This makes it a little less confusing to my eye. I hope this works for you too.

Telrad SSB PCB

Download the PDF    Israel Board Schematic Ver 1.2 ZL4SAE

The signal input is on pin 16, where it passes through a couple of resistors before being split to the FET and the Low Pass Filter. The FET circuit buffers the signal, rectifies it and routes the resulting DC to pin 13. Purpose ? Unknown.

Following the LPF, the signal is coupled into the mixer by a 22uF capacitor. Yes 22uF. This is a Tantalum part, as are most of the polarised capacitors on the board. Top left corner of the pic. Something tells me this is not an RF signal. The output of the mixer is undoubtedly DSB at 9MHz. The following ( roofing ? ) filter is AM bandwidth at 9MHz. So the local oscillator input at pin 10 could well be a carrier, and the signal could be audio. The DC at pin 13 then maybe acts like a VOX or squelch circuit. 

Following the AM filter the 9MHz I/F is amplified in the MC1350. It then passes to both SSB filters, only one is selected, then to the second mixer.

The stages following the second mixer are at audio frequencies. The required sideband is selected by the voltage level on pin 7 which gates the 4016. So only one of the 2 sideband mixers or filters, is actually used at any one time. The CIO or BFO is applied via pin 9. This must surely be at 9.000MHz in order to demodulate the SSB signal from the filter.

The audio is passed to an Op Amp filter circuit, it looks like bandpass. Comprised of high pass / lowpass. Then the signal is routed to the 600 Ohm output transformer at pins 5 and 6. Pins 1,2,3 and 4 carry the same signal at different impedances along with a couple of grounds. A sample of the audio is also fed to the Plessey SL1621 AGC generator. The capacitor values around this device are approx 50% of those in the data sheet. This would make the AGC response quite fast I believe.

The overall circuit had me confused for a while. The Yahoo group has certainly helped by proving that the board receives SSB. Not so sure about AM. AGC is applied to the MC1350. So the signal level must be expected to vary, as we expect in a receiver. The switches in the AGC circuit appear to be able to select normal, delayed or off. I would have expected the AGC to also drive an S meter, but there is nowhere in the circuit to sample the AGC for indicating purposes, that has been brought out to a connection point. Test point three looks like a good candidate.

I have had the board powered up, but no signals yet. The negative voltage generator measured 9.5v off load and 6.5 when connected to the PCB. Not enough current available I assume. A better solution is needed.

Ultimately some modifications around signal pin 16, changing the 22uF capacitor and removing the LPF would enable the first mixer to accept RF. The Carrier input would then be the LO. It might make an interesting receiver.

If anyone has made any more progress than this I would be more than happy to hear from you. gw4sae at AOL dot com

Thanks to Chuck K8LBH for the link to his YAHOO group, they are actively building radio’s using the PCB. 

https://groups.yahoo.com/neo/groups/ssb-avenger/info

Ricardo / CT2GQV. Also has some information

http://speakyssb.blogspot.ie/2017/04/more-filters-iii-telrad-board.html.        Also there is information about the filters

WSPR VOX for the FT-817

A simple VOX interface for WSPR.

Having recently acquired an FT-817 I was interested in trying it in WSPR mode. It didn’t take much research to discover that the DATA connector on the rear panel has bi-directional audio, labelled as data. PTT is also available on the same connector. Unfortunately there is no VOX capability when using this port.

 

I already had a couple of USB soundcards ( $5 on eBay ) so I decided to utilise one of them as an audio interface to the USB port on the laptop. I removed the USB plug and replaced it with a socket. A standard USB to USB connects the interface to my laptop. The audio jacks were also removed and the mini DIN was wired directly to the exposed pads.

Since the soundcard can produce a few volts of audio during transmit, I decided to use a simple voltage doubler to convert some of the audio signal to DC for the transistor switched PTT control. The audio is delivered directly to the voltage doubler, but is potted down for the transmit drive to the radio. A series resistor also helps protect the mic input of the soundcard. You should set the mode to DIG.

To my surprise, the whole thing worked first time and spots from Australia and USA were reported during the first 500mW transmit cycle. WSPR really is an amazing mode. The most difficult part was getting it in the box, neatly !

The box is the smallest from Jaycar. Shown without the lid. The braid simply bonds all the ground points with a low impedance path.


Version 1.1

Took a little time to get the layout ‘safe’, so that none of the parts touched.

No box. Maybe some heatshrink tubing.

LM380 Audio Amplifier using Me Squares

My favourite construction method, with NO GLUE !

I am forever tinkering with circuits of one kind or another. Usually receivers. Etching a PCB for a one off project is too time consuming and hardly cost effective. On the other hand, strip-board is not the best medium for RF construction. I am also not a fan of “ugly construction”. So for many years I manually cut squares and oblongs onto my PCB’s using a craft knife and a steel straight edge. Then I discovered ‘Me Squares’ and ‘Me Pads’. My first few project using these pads took up more space than I had bargained for as the pads were spaced out to accommodate the components. Also it was a bit messy getting just that tiny amount of super glue on the pad. Then one day I accidentally knocked over a half full bottle of glue. It was difficult to put things down for a while !

Later, while building a classic post mixer amplifier, I drew the pad layout on squared paper. The individual pads were just a few mm apart. I quickly realized that if I stood some of the resistors upright I would not need to separate the pads at all. A little further planning and I had the whole circuit module on pads, in one piece. I recommend spending a little time on this, as the result is well worth the effort. Just follow the schematic layout from left to right. Try to get at least one grounded component on each side of your module.

This example uses the 8 pin audio amplifier the LM380-8. Here is the schematic.lm380_schematic

Here is the module built on pads and squares.

lm380_pads

Here is the same module mounted on the PCB. There are usually sufficient components going to ground that NO GLUE is needed to hold the module down to the copper substrate.

lm380_pcb

The grounded components are holding everything in place. I’m sure there will be the odd occasion when a pad will need to be glued down. For me this is a last resort, and I now use double sided adhesive tape if really needed.

Most of the projects posted here are constructed in this way. You should try it, it really works well, and it undeniably look good.

73 from ZL4SAE

 

WSPR 30 Receiver Schematic update.

There was an error in the feedback resistor value on the schematic near the NE5534. It was shown as 1k5. This resistor sets the gain of the op-amp stage and should be 220k, giving a gain of 146, or 43db.

In the schematic below it is marked as Rf1.

My apologies for not noticing this error sooner.