Revised thinking on STC chips

I have successfully implemented a few projects on the STC 15F104E, a Chinese 8051 architecture MCU.

STC15fF04EThe chip includes EEPROM, and some flexible extensions to the timers which potentially make it more useful than a standard 8051.

I have previously observed that the documentation is poor, and the programming tool is poor.

The project that led to the latest observations was an attempt to implement RC PWM – ON/OFF switch originally on one of these chips as it contained sufficient resources to suit the application. One of those resources was an +/- edge triggered INT0.

The code worked fine, but for only a short and variable period. Essentially, the the main loop was executing fine, the chip stopped triggering the interrupt service routing for INT0 after a variable time from 10s to 1000s… but it ALWAYS stopped working. Cycle the power and the same thing is observed. Continue reading Revised thinking on STC chips

RC PWM – ON/OFF switch

This article describes a remote ON/OFF switch which uses an RC receiver and adapter chip to convert the RC PWM signal into an ON/OFF output. (Suitable RC transmitters are on hand.)

The immediate application is for remote ON/OFF PTT or KEY of a transmitter for field strength testing at various locations.


Remote control hobbies have long used a multi channel digital proportional protocol for control of planes etc. The simplest multi channel receiver has an independent PWM output for each servo.

The PWM signal is a 1000-2000µs pulse with a repetition rate from about 50Hz up to 500Hz or so, the duration of the pulse conveys the information.


The converter chip is a ATTiny25 MCU with firmware that monitors the PWM stream and provides ON/OFF and OFF/ON output pins. For the immediate application, the ON/OFF (or non inverted) output drives a 2N7000 FET with ‘open collector’ output suited to the PTT and KEY lines of most modern transceivers.

The firmware ignores PWM signals with duration outside the range 900µs to 2100µs, and switches ON at 1600µs, and OFF at 1400µs to provide some hysteresis. If PWM input is lost for 125ms, the output will fail safe OFF.

rcsw01Above is the schematic. The 2N7000 is good for 60V, can handle up to 100mA without a heat sink, and had a body diode to absorb transients if the load is a relay. Continue reading RC PWM – ON/OFF switch

Trial of prototype stand alone GPS logger

An upcoming project calls for a stand alone GPS logger.

The requirement is for a GPS stream that allows correction using RTKLIB, but this trial is of a lesser GPS as proof of concept.


Above, the equipment consists here of a Ublox NEO-6M based GPS module (~A$15 incl on eBay) at left, an Openlogger (~A$15 incl post on eBay) at right, and a 12V-5V converter (~A$7 from Hobbyking) at bottom. The latter is a 5A converter, way overkill, but it was on hand. The GPS module has a 3V regulator on board for the NEO-6M chip.
Continue reading Trial of prototype stand alone GPS logger

OpenLog for TinyTrak – drive test


A drive test of the OpenLog logger collecting raw NMEA data in parallel with the TinyTrak (VHF) was conducted. To maximise the performance of APRS, a fill-in digi / iGate was run at my home. The tracker used a 65W transmitter with quarter wave vertical in the centre of the car roof.

Google Earth googleearth 29/10/2015 , 08:19:01

Above is an overview of the APRS and OpenLog tracks. Click on the image for a scaleable / zoomable view in Google Maps. Continue reading OpenLog for TinyTrak – drive test

OpenLog for TinyTrak

There are a host of factors that contribute to data loss in APRS, to name just some:

  • non-standard / sub-standard / poorly configured digipeaters;
  • defect ridden iGates that lose, duplicate and corrupt packets;
  • poorly configured mobiles;
  • network congestion and interference;
  • unpredictable equipment failures;
  • basic geographical coverage of the network; and
  • dependence on the ionosphere for HF APRS.

This article describes an enhancement to the popular TinyTrak (and its clones) to also capture the GPS stream to an inexpensive local data logger.

The logger does not interfere with normal radio APRS, it coexists with it and creates a properly timestamped fine detail log of positions over a very long time, a log that can be post processed into a range of graphic / map and tabular reports.

Data logger

The datalogger used in an OpenLog. It is a simple logger that writes data to a micro SD card, costs about $A12 (inc post) for the logger and about A$10 (inc post) for a 16GB Class 10 micro SD card. (A slower card could be used, but they aren’t much cheaper.)


Above, the OpenLog data logger.
Continue reading OpenLog for TinyTrak

DIY USB password generator – (USB PRC) enhanced #1

This article describes an enhancement to the DIY USB password generator, a small USB HID keyboard device that types a password stored in EEPROM automatically when it is attached.


The implementation was on a Digispark ATTINY85 General Micro USB Development Board which was purchased on eBay for a few dollars. The board uses different pin connections to USB to the original. Continue reading DIY USB password generator – (USB PRC) enhanced #1

DIY USB password generator

This article describes an implementation of the DIY USB password generator. It is a small USB HID keyboard device that types a password stored in EEPROM every time it’s attached.

Digispark01The implementation was on a Digispark ATTINY85 General Micro USB Development Board which was purchased on eBay for a few dollars.

The board uses different pin connections to USB to the original, and requires a hardware jumper from D+ (PB4) to INT0 (PB2).

In the process of changing the code, I updated the V-USB driver. That necessitated quite a few changes to source code.

The updated code was compiled, and tested just fine.

Changed / updated code (includes hex):




Some tools for designing a Guanella 1:1 balun using ferrite toroids

In designing a Guanella 1:1 balun, selecting a ferrite core that has been characterised by the manufacturer simplifies the design process greatly.

The manufacturer’s full characterisation includes curves for complex permeability vs frequency and from these the magnetising impedance of the core can be calculated. Note though that tolerances on magnetics are usually fairly wide and they can be quite temperature dependent.

The inductor will usually exhibit a self resonance that is not revealed by the above calculation, but can be reasonably well modelled by adding a small equivalent shunt capacitance, see (Knight 2008). This equivalent capacitance is usually very important and not so easy to estimate, and is often best estimated by careful measurement of the self resonant frequency of the inductor (taking care to back out fixture effects). With experience, one can make a fairly good first guess so that the process is not too iterative.

Some writers say that Cs increases as turns are increased, but (Knight 2008) shows quite the opposite.

Controlling inductor self resonance is a lot about controlling added stray capacitance, eg connecting wires, encapsulation in conductive boxes etc.

Clip 036

Above is a plot of common mode impedance of a FT240-43 ferrite toroid with 11t wound in Reisert cross over style and Cs=3pF. Different scenarios will give different results, but the form will tend to be similar to above. Continue reading Some tools for designing a Guanella 1:1 balun using ferrite toroids

DYS SN20A out of the box

I was intrigued by the seemingly endless stream of stories of woes with the DYS SN20A (eg RCTimer / DYS Mini SN20a / SN30a / SN40a esc), so I purchased one to see if they are all bad. Of course, impressions of a sample of size one are of somewhat limited value, but it seemed like an interesting thing to do.

Some reports of problems seem to relate to use of BLHeli on the ESCs, and it seems at least one beta release of BLHeli v14 had defects that resulted in serious damage in unprotected tests.

Discussion blames problems on front ends, flight controllers, wiring, motors, ESCs hardware, firmware, and bootloaders… but all these possible causes evident more so with this one ESC does not seem likely or logical. With the quest for more rapid FC loop response, there is a risk of instability and the drive may be working harder with oscillating demand, only logs from a flying craft will reveal what may be happening in that respect.

The test ESC

The DYS SN20A was purchased 14/06/2015 from RCTimer for about US$19 inc post. Not an inexpensive ESC by any means.

The DYS SN20A is described as an “opto” but I doubt it is optically coupled, it is probably just another instance of the fraud in terminology where opto refers to a BECless ESC. (If it were optically coupled, it would almost certainly not be a bidirectional servo interface and the SimonK bootloader would not work… but it did.)

SN20-01Above, the top view of an unwrapped SN20A. Continue reading DYS SN20A out of the box

Designing a Guanella 1:1 balun using the ‘unknown’ ferrite toroid

At Characterising an unknown ferrite toroid an ‘unknown’ ferrite toroid was characterised. This article uses that information for design of a Guanella 1:1 current balun.

The proposed design uses 11t of small coax wound in the Reisert ‘cross-over’ style.

The impedance of a single turn vs freq was used to predict the impedance of an 11t choke. Such a choke exhibits a self resonance that can be represented as due to an equivalent shunt capacitance. This equivalent capacitance is not easily estimated, and can best be determined by calibrating an analytical model of the choke for the same self resonance as exhibited by a real choke.

Clip 030

Above is common mode impedance from an analytical model of the choke, assuming an equivalent self capacitance of 11pF.
Continue reading Designing a Guanella 1:1 balun using the ‘unknown’ ferrite toroid