17 October 2008

FT817 keypad for serious QRP /P contesting

In August 2008, after a productive VHF contest outside at 2700 masl (8800 feet asl), I felt the need to add an external keypad to my FT817 so that some controls would be readily accessible.

After a few months of software and hardware development I am announcing an alpha version of my keypad!

It is based on Atmel's ATtiny2313 microcontroller, uses very few components and does almost everything I wanted it to. Functions have been tailored to what I needed most last August, and the current release does the following:
  • direct frequency dial
  • mode change
  • VFO toggle
To be tested (tonight):
  • Presets QSYs to QRP frequencies (16 of them)
Still being studied:
  • Output power control
  • VOX on/off control
  • Meter mode control
but I am afraid these last will not fit into the 2313 program memory. So a modular approach might be suggested: functions are loaded as needed by the operator depending on the activity type (contesting, SOTA, ragchewing, ...).

Given the 4x4 keypad layout of the top table (see below), key functions are depicted below per each function.

Frequencies are entered with leading zero-padding to 100's of MHz: 007030 for 7030 kHz, 014060 for 14060 kHz, 0035C for 3500 kHz, 028# for 28 MHz, etc etc.
Mode switching is a star "*" followed by another key (see the Modes mapping).
Frequency presets are accessed with pound sign "#" followed by another key (see the Presets mapping).
VFO toggle is a single key press, as well as should be other functions under development (power, vox and meter).


Keypad Layout
1 2 3 A
4 5 6 B
7 8 9 C
* 0 # D




Main Menu
1 2 3 VFO Toggle
4 5 6 PWR cycle
7 8 9 VOX toggle
to Mode 0 to Presets Meter mode




Frequency dial
1 2 3 end
4 5 6 end
7 8 9 end
end 0 end end
Usage:
014060 = 14060 kHz 144305 = 144305 kHz
014# = 14000 kHz 007C = 7000 kHz




Modes
CW CW CW CW
AM FM CWR CW
USB LSB CW CW
CW CW CW CW




Presets
1843 CW 3560 CW 7030 CW 10116 CW
14060 CW 18096 CW 21060 CW 28060 CW
14285 USB 50090 CW 21285 USB 28500 USB
144300 USB 50150 USB 432200 USB 29500 FM


A LED blinks at each keypress. The current consumption is about 10mA and the device can be powered directly from the ACC socket (where the commands are sent).

This keypad is not meant for a home-based station, where some excellent computer programs can do this and a lot more. It is an operator's aid when having fun on the field.

The same code might work with other Yaesu transceivers, like the FT857.

Interested?

14 October 2008

The LED, as seen from 250m

I left the LED TX at my parent's, waited for the night to come, then asked them to fire it up and beam it towards me. Currently the TX draws 36mA. This is the view from the farthest window:

And zooming in... the LED signal is there:

The picture was taken with a 2MP cameraphone without any optical zoom. At the naked eye (not fully adjusted to darkness) the beam was a bright red spot. With a tripod it could be possible to keep the maximum intensity in the right direction. Distance: approx 250 metres.

I couldn't try a reception test because the RX circuit is being boxed and adapted for a telescope mount. Fortunately I've met an enthusiastic amateur astronomer that now wants to become famous by breaking the world optical record. Simone might even learn morse code :-)

Meanwhile I'm slowly building a second TX-RX pair, with the TX capable of sending FSK for an RTTY test.

07 October 2008

Attiny2313: listen and repeat

It took about two hours, three evenings and twenty re-programmings to get it working. Though, it probably worked even the first time, since the problem was not in the code.

Once I had verified the 4x4 keypad was read correctly and mapped the Getkbd codes, my target was to send the FT817 a "VFO Toggle" command.

With one Printbin combination I could only get the radio to tune 10'101,01 kHz, while it was supposed to change VFO.

As a last resort I reduced the communication speed from 9600 to 4800 baud (on both the chip and the radio!) and it magically started working. I could also program a static VFO retune command. Cool.

Since the code was not changed I can only assume the internal clock is either not suitable for (fast) serial communications or it is way off the declared/programmed value.

02 October 2008

My ATtiny2313 said "Hello World" !

Yes! Yes! Yes! What was I doing wrong?

I could initially program a HEX file into the chip, but that code was downloaded from Internet and probably meant for the older AT90S2313. I had rewritten and recompiled the same code with BASCOM-AVR for the ATtiny2313 but somehow I couldn't get the program into the chip: everything completed correctly, I could change fuse settings, but the CODE memory wasn't updated.

So I tried a -e (erase chip) round with avreal32. Reading the uC content resulted in a lot of F's: the chip was blank.

Then I wrote the code back and ... magic! The LED flashed. Remember: the ATtiny2313 (probably) comes pre-programmed to use the internal 8 MHz clock divided down by 8 to 1 MHz, so you don't need any external component.

This is the BASCOM-AVR code. Don't forget to play with GUI settings to set the proper chip.


Config Portb = Output 'set port B as output

Do ' eternal loop
Portb.0 = 1 ' make portB.0 high
Waitms 500 ' wait 500ms
Portb.0 = 0 ' make Portb.0 Low
Waitms 500 'wait 500ms
Loop


Press F7 to compile. Take the .hex file and feed it to avreal32 (see previous post for the command line string).

The circuit? PortB.0 is pin 12 on ATtiny2313. Wire as follows:
  • pin 20 to +5V
  • pin 10 to ground
  • pin 12 to a LED cathode
  • LED anode to 270 ohm resistor (or 220, or 330 or 100+100+100 ohm, you got the pointt)
  • the other resistor terminal to +5V
Ready for the smoke test? :-)

30 September 2008

My first Atmel program

I have been able to program an ATtiny2313 with a very simple setup:
  • 1 DB25, 3 resistors and one 20-pin socket
  • avreal32 Win software
  • computer with a parallel port ("LPT")
Even the laptop was able to drive the programmer. Although the female lab personnel (AKA wife) said the programmer doesn't look trustworthy, it did the job.

I can both read and write the uC. The "reading" ability is a huge improvement from my serial PIC16F84 write-only programmer, since I can write the chip and then verify what was written on it. This is how I know the chip was programmed with my code.

The commands for my LPT1 and my programmer:
READ: avreal32 +TINY2313 -ap -p1(0x378) -o0 -r a.hex
WRITE: avreal32 +TINY2313 -ap -p1(0x378) -o0 -w -c b.hex

Reading the chip displays:

v1.26rev0 (Aug 7 2008 17:52:48) http://www.ln.ua/~real/avreal
bug-reports, suggestions and so on mail to [censored]
Command: +TINY2313 -ap -p1(0x378) -o0 -r aaa.hex
Power ON
Device connected, TINY2313 detected
Chip not locked
Fuses
OSCCALs = 68 6A
CKDIV = 0
CKOUT = 1
SUT = 2
CKSEL = 4
DWEN = 1
EESAVE = 1
WDTON = 1
BODLEVEL = 7
RSTDISBL = 1
SELFPRGEN = 1
Reading CODE memory
.... done
Reset pin released
Power OFF


Fuse values are displayed in decimal, while the datasheet lists their meaning bitwise.

Unfortunately the success was only partial, since the uC didn't seem to produce any activity out of the programmed code.

25 September 2008

Optical system going NLOS

Thanks to the interest of a colleague in my optical experiments, I sped up the work on my MCW light receiver.

Using a 10mm red LED at ca. 30mA and the OPT201 without any lens or post-amplification I could make some spectrograms with Spectrum Laboratory.


First of all I studied the environment: the incandescent bulb produced a clear set of harmonics every 50 Hz, with those at n*100 Hz being stronger ("1"). Then the 520 Hz line is definately the laptop TFT dimmed backlight ("4"), since at full brightness the signal disappears. Notice the result of a mixing between 488 Hz MCW signal and the strongest 100 Hz harmonic ("2"): this certainly occurs at electrical levels, not optical.

Next was a ca. 4.5m LOS test, with the LED light overloading the sensor. Even the cameraphone could see it:


I used my CW memory keyer to send a meaningful message (pre-recorded holiday CQ) at the lowest possible speed, about QRSS0.5 (0.5 seconds per dot).

In total darkness except the laptop screen, the spectrogram looked like this:

A quick test at 15 WPM revealed a perfectly readable signal. The shade effect of a hand obstructing the light beam is surprisingly strong. A wav recording is available, if anybody wants to hear it.

Then I moved the TX further away in another room, for a total of 11.5 metres Non Line Of Sight (NLOS). Only after my eye had adjusted to darkness I could see some weak red reflections on objects in the intermediate room, but the spectrogram was faster:


There it is! My QRSS CQ was on the screen, fortunately not masked by the laptop backlight. Remember the receiver had no focusing lens whatsoever.

I forgot to measure the response of OPT201 with a 3.3 Mohm series feedback resistor. Next test could be 300m LOS still without lens on the receiving side.

Stay tuned! Or better.... watch out! :-)

22 September 2008

NiMH constant current charger

I started working on this circuit long ago, and never used it thoroughly.

Given that NiMH cells can be slow-charged at a constant current rate for a given amount of time, I built this circuit. Provided the timed slow-charge condition is verified, you can live without end-of-charge algorithms.

Some charging facts (if I remembered where I read this, I'd credit the author).
A NiMH cell, if charged at C/10, in 10 hours will reach approx. 66% of the fully charged state. You achieve the remaining 33% with 5 more hours. That's where the magic 15 hours come from.

My constant current circuit required a PNP transistor. I picked a BD646 from the junk box in a TO220 package. Since the transistor had to be floating from ground, I needed a way to attach it to the metallic enclosure for thermal dissipation without electrical contact.
Forgot about nylon screws, a search through the electronic junk showed this solution: wrap the transistor in what I believe to be a mica foil and then press it against the heatsink/box.

This is how it looks like:




I recharged a 9.6V pack while watching the temperature and the current. The transistor runs barely warm, while the power resistor heats up considerably.

The pack under charge will increase its voltage, thus effectively reducing the charge current, in a auto-stop fashion. But since this occurred quite early in my charge cycle, I had to increase the input voltage to more than 14V.

One word of caution about the plugging sequence.

Charge start: connect the power supply and then the battery pack
Charge end: disconnect the battery pack and then the power supply

Otherwise the pack will discharge into the power supply. Probably a 1N400x diode on the +Vcc line blocks the process and allows to use a timed AC socket.

02 September 2008

The Amateur's Code

I'm copying and pasting this text here for future personal reference. A Good Reading anyway!


The Radio Amateur is

CONSIDERATE...never knowingly operates in such a way as to lessen the pleasure of others.

LOYAL...offers loyalty, encouragement and support to other amateurs, local clubs, and the American Radio Relay League, through which Amateur Radio in the United States is represented nationally and internationally.

PROGRESSIVE...with knowledge abreast of science, a well-built and efficient station and operation above reproach.

FRIENDLY...slow and patient operating when requested; friendly advice and counsel to the beginner; kindly assistance, cooperation and consideration for the interests of others. These are the hallmarks of the amateur spirit.

BALANCED...radio is an avocation, never interfering with duties owed to family, job, school or community.

PATRIOTIC...station and skill always ready for service to country and community.

--The original Amateur's Code was written by Paul M. Segal, W9EEA, in 1928.


[...meanwhile in the lab a constant current NiMH battery pack charger has been completed and tested...]