Dividing Head Controller

This post ist about the CNC conversion of a manual dividing head aka indexing head. If you’re not familiar with that kind of equipment, there’s a wiki page here.  One makes use of interchangeable indexing plates and and the internal worm gear to accurately divide the circle. Parts like cogwheels and the like can be machined this way. A video of the finished project can be found here on my youtube cannel.

The downside is that a high level of concentration is required to not mess things up. Often a single distraction is all it takes to ruin a part. Besides the fact that constantly changing indexing plates can get tedious. So I decided to mount a stepper motor to that indexing head and to design a controller to take care of that motor.

There are many affordable and well-designed stepper motor drivers out there so I decided to use one of those rather than building my own. So an external driver takes care of translating the 5 volts logic step / direction signals into the (typically 12, 24 or 48V) power signals required to drive the stepper motor. What this circuit does is to provide a user interface and to generate that step / direction signal.

I decided to use this motor driver from Planet CNC that comes with a 2×5 pins 100-mil header for the logic signals. So I also put such a connector with a corresponding pin-out on my board. Then a single ribbon cable (provided with the motor driver) is all it takes to hook up the driver.

The user interface consists of a 4×20 character LCD display and two rotary encoders with push buttons. The display is a Midas MCCOG42005A6W that I have used in several of my other projects before. It is very compact and comes with an I2C interface which saves quite a few pins on the microcontroller. There is also a buzzer to provide some acoustic feedback on button presses and the like. If it enoys you, you can always turn it off in software.

As in all my designs, the rotary encoder signals are nicely debounced in hardware as described here.

The board runs on a 24V supply that is also used to drive the motor. The microcontroller, a Microchip PIC1826J50, runs on 3.3 volts. Furthermore, the motor controller requires a separate 5V supply to power its logic. So I first designed a switching converter that generates a 5V output from any input voltage in the range of 6 to 30 volts. A linear regulator then produces 3.3 volts out of that 5V rail to power the PIC and other on-board logic. Unfortunately, a bug as creeped into my PCB layout – hence that fix with a piece of wire just below the coil.

With the PIC running on 3.3 volts and the motor driver at 5 volts, I also had to provide some logic-level conversion.  A 74AHCT125 line driver / buffer and a few resistors take care of that.

The PIC also comes with a USB interface so that the board could be controlled remotely from a PC. All the hardware for that is present on the board but I haven’t written any software for that yet. Most of that can be copy-pasted from other projects such as the solar charger but I simply haven’t done any of that yet.

Finally, there is a temperature sensor and a fan output on the board. I’m not currently using it but if there is need for a fan for the motor driver and/or the power supply, you can connect a fan directly to this board and have it temperature controlled. For the fan output, the buzzer and the display backlight are driven by a TPL7407L that already includes the free-wheeling diodes necessary to drive inductive loads such as a fan.

I’ve mounted all the power supply, the motor driver as well as this board in a nice, compact case that I bought at a flea market earlier this year.

Nice, solid ground connections are provided to all relevant components. The USB connector is accessible from the back through an extension cable.

The other USB connector belongs to the motor driver and is used for configuration.

Finally, the two knobs for the rotary encoders were turned out of aluminum at the lathe.

The rest of it is mainly mechanics. This may seem somewhat off-topic on this blog but expect to see more of it in the future 😉

Here are the parts required for the mechanical part of the CNC conversion. With the exception of the two cog wheels for the timing belt, they are all machined out of aluminum on a manual mill.

First, a spacer is mounted using three existing, M5 threaded holes.

The main body is then screwed onto this spacer and the cogwheel is mounted.

The hub of the cogwheel was turned out of steel and then press fitted to the aluminum cogwheel. This provides for a firm, true-running.

Then the motor with the 22 tooth sprocket can then be mounted together with the 15mm HTD-5M timing belt. Together with the 44 teeth cogwheel on the other end, this provides a 2:1 geering. The dividing head’s internal worm drive adds another factor of 90:1.

Since the motor, a Sanyo Denki 103 H7823 1740, has a resolution of 200 steps per revolution, this translates to a very convenient 0.01 degrees per full step.

Now all that is left to do is to fix the cover plate. As usual, all the relevant files are on github:

USB Mass Storage Device Bootloader

Let’s start with a video. It will tell you most of what I’m going to write about today.

That Hackaday Prize final has passed and unfortunately for me, the solar charger didn’t make it into the top 5. The good news is that there are plenty of projects and stuff that I would like to share. Things that I did over the last one or two years but never had time to write about. I’m trying to catch up with all that now.

First of all, I have completed the USB bootloader for the solar charger. This part of the project will enable the non-technical end user to easily and reliably update the firmware in the field.

Unlike a USB HID (Human Interface Device) bootloader that requires some application to run on the host computer, this USB MSD (Mass Storage Device) bootloader requires absolutely nothing in terms of host software. It’s entirely independent of the OS used. Windows, Linux, Mac, it all doesn’t matter. As long as they can deal with a USB drive, they’re good to go. Just copy the new software (in the form of an .hex file) to the Solar Charger drive and follow the instructions on the display.

It might even be that this bootloader is the world’s first of its kind for the PIC18 platform. To be sure, this kind of bootloader has been around for years for more powerful 32-bit microcontrollers like ARM Cortex and the like. But in my online research I have been unable to find any other such project for the PIC18 family (or any other 8-bit microcontroller). So I had no choice than to write my own. If you know of any other implementation, please let me know.

Once the file has been found and the user has pressed the button, the file is checked. If all those checks pass, we can be confident that we have a valid hex file. Of course, it doesn’t tell us anything about the quality of that code, that’s an other issue. But technically we should be fine.

Once the checks have passed, the user is once again requested to press the push button to confirm that this file should be programmed onto the chip. While it’s programming, it keeps displaying the current hex file entry it is processing to give the user an idea of the progress. It also keeps track of the number of flash pages it has written. One page corresponds to 1024 bytes on this architecture.

Once all the new code is flashed onto the chip, a message is displayed and the user is asked to once again press a key to re-boot the device into normal operating mode.

There are two different ways to enter bootloader mode. One is to press the push button at power-up. The other one consists in writing the value 0x94 (an arbitrarily chosen value) to the EEPROM address 0x100. In this case, the device will start up in bootloader mode no matter the state of the push button. The bootloader then overwrites this value (to 0x00) in order to start up normally next time.

After the reboot, you should be greeted by the startup screen of the solar charger firmware as shown above.

While I wrote this bootloader specifically for the solar charger, the code is rather universal. It can be ported to other PIC18 projects with relatively little effort. As always, the code’s on github: https://github.com/soldernerd/PIC18_USB_Bootloader.

Solar Charger in Hackaday Prize Finals

I’m delighted to tell you that my MPPT Solar Charger has been nominated for this year’s Hackaday Prize Finals taking place on October 22nd.  I’ve submitted it in the Power Harvesting Challenge category a while ago and was just informed that it was picked as one out of twenty projects submitted to the finals. Check out the original article here. Of course, any support is highly appreciated.

If you check out the project description on hackaday.io you will notice that my blog is somewhat lagging the latest developments. But don’t worry, I hope to post more updates as well as a few videos soon.

MPPT Solar Charger – Revision F

While the solar charger was originally intended to be used as a standalone device, it can just as well be integrated into other projects. In such applications, the user interface can be left away without sacrificing functionality other than the display and rotary encoder.

One project doing just that is MeshPoint, a rugged wifi hotspot for disaster and outdoor areas. But in most cases, the main application needs to be able to communicate with the solar charger. It wants to know if power is harvested, how full the battery is and so on. It needs to be able to enable and disable the various power outputs and maybe to control the fan. Or maybe it wants to make use of the charger’s real time clock and calendar. Or store some configuration data on the charger’s EEPROM. Possibilities are endless.

And when it comes to external communication interfaces, all the chargers up to revision D had little to offer other than the USB interface. Depending on your project, adding USB host functionality may be inconvenient or even totally out of the question. There was always the possibility to somehow tap the display’s I2C port but there was no extra header on the board for that.

Revision E has finally changed that. The charger now comes with two extra headers, one for I2C and one for SPI. As of now, the PIC acts as a master on both of those buses but slave functionality can be (and is planned to be) added in software. Hardware-wise it is even possible to update the charger’s firmware through those interfaces. I must admit that this is not the number one priority to be implemented but its nice to know that the possibility is there.

With the implementation of the USB bootloader next on the agenda I also upgraded the microcontroller to the newly introduced PIC18F47J53. It is extremely similar to the previously used PIC1846J50 and entirely pin compatible so it didn’t require any changes to the board. But it has twice as much flash memory (now 128kB) which allows for a feature-rich USB bootloader without runing into any issues memory-wise.

Another nice thing about it is that it has many more PWM modules which means that all four power outputs can now be PWM controlled. Think of LED lighting which is probably one of the main uses of those outputs. As a bonus, it also comes with an 12bit ADC which means four times the resolution on the temperature sensors.

When modifying the software to fit the new board and microcontroller, I noticed that my pin choice for the external SPI slave select signal was somewhat unlucky. I happend to pick one of the few pins without PPS (peripheral pin select) functionality which can be a problem if you try to use that interface with the charger configured as slave. The fix was easy, just swapped two pins but required a slightly modified board. That’s why the current version is now revision F.

Click here for the previous post in this series.

Free Solar Charger PCBs

A reader of this blog was so kind to send me a number of surplus boards of two of my solar charger designs. Thank you, Joachim.

Solar Charger Hall of Fame

[November 10, 2017]

After just a few days, all of the boards were sent out to all over the world. Today, the first photo of an assembled board has arrived. I’ll post this and all following photos here:

By Orkhan from Germany

Arduino Solar Charger

The first variety is my Arduino solar charger shield. Being my first attempt it is maybe not the most advanced design but it’s by far the simplest. So it’s well suited if you want to get your hands dirty while keeping the level of complexity reasonably low and do all your programming via the Arduino IDE. And despite its simplicity it operates very efficiently – apart from the power-hungry Arduino.

Solar Charger Rev C

This is a relatively recent and far more advanced design. It is very low power, highly efficient, comes with USB and lots of bells and whistles. So if your ambitions are somewhat higher this board is for you.

The Rules

Now here are the rules. As the title of this post suggests, I give these away for free. I ship them world wide absolutely free of charge. All I ask for in return is a photo of the assembled board within 6 weeks after you get the board. A maximum of 2 boards per person (one of each design).  First come first served. Just send an email to [admin at soldernerd dot com].

RaspberryPi Robot

It’s been almost two years since I did (or at least started) this project but I never sat down to document it. That’s what I want to do today. As the title says it’s about a little robot based on a RaspberryPi. Like many of its kind it is driven by a pair of stepper motors each driving a wheel directly attached to the respective motor axis. At the back there is another smaller, pivotable wheel to keep the robot in balance.

Here’s a video of the finished robot in action, running a simple demo program demonstrating the various functions.  By the way, I’ve started a youtube cannel to share these kind of videos. I’m not really a video guy so this text and photos blog will stay my main medium but some projects like this robot, videos are a welcome addition.

Yes, I’m well aware that many similar designs already exist out there I could just go out and buy a kit like this. But making my own sounded more interesting so when I was looking for a Christmas present for my godson of sorts I did just that.

Above is a close-up of the main PCB that I’ve designed and built for this project. The idea is simple: There is a PIC16F1936 microcontroller that communicates with a RaspberryPi over I2C. The PIC then handles all the low-level details of controlling a pair of Allegro A4982 stepper drivers. These work at up to 35 volts, handle up to 2 amps of current and can hence drive much more powerful motors than the relatively small NEMA 17 size motors I’ve used here. They are easy to use and feature microstepping up to 16th steps.

Besides the two stepper drivers there is a ULN2803 providing 4 power outputs capable of driving up to 1 amp each. The ULN2803 includes free-wheeling diodes so these outputs could be used to directly drive somethingn like a relay or a DC motor. But at least for now these outputs drive some RGB LEDs at the front as well as a buzzer.

The original idea was to power the RaspberryPi  from the 5V linear regulator on the board and then draw the power for the PIC from the RaspberryPi’s 3.3 volt rail. Since the PIC uses only a few milliamps that’s entirely possible.

Unfortunately I haven’t given that setup a lot of thought before building the board. Of course, when powered from something like 12V, the LM2931 regulator gets way too hot when powering a RaspberryPi that pulls a few hundred milliamps. So I’ve sacrificed one of my solar charger RevC boards that includes two very powerful USB charging outputs.

During testing and debuggin I’ve used a small 12V AC/DC converter screwed to the bottom side of the robot. Once more or less completed I’ve changed the power supply to an old 3-call (11.1V) LiPo battery from a RC helicopter. It’s no longer fit for flying but still adequate to power this thing for a few hours.

The entire structure is laser-cut from 5mm medium-density fiberboard and held together with M2.5 torx screws with square nuts. M2.5 square nuts measure precisely 5x5mm so that goes together rally nicely. I’ve added and changed a few things as I went along, drilling extra holes to mount the blue PCB for the power supply, the LEDs, to hold the battery in place and some other things. But the structure as such works very nicely. It’s relatively simple if you have some place to do laser cutting (try your local fab lab…) and is inexpensive and sturdy.

The weels are laser-cut from the same material and are sized to measure precisely 200mm in circumference. That’s handy since the steppers feature 200 steps per rotation. 

 

That’s about it, most of the relevant files are on github. The OpenSCAD files for the laser cutting are not so just let me know if you’re interested in them. I’m happy to share them, too. Here are the links for the software and hardware, respectively.

As always, I welcome any thoughts or comments.

MPPT Solar Charger – Update

It’s been a while since I posted anything related to my MPPT Solar Charger project. That doesn’t mean that no progress has been made…

I’ve performed many hours of testing, pushing the charger to and even beyond its 75 watts rating. I was able to confirm the very high efficiency n the range of 96 to 98% over a wide range of loads from 1 to 75 watts. And I’m happy to report that during all those tests I haven’t damaged anything. I’m more than pleased how this little charger is performing.

The most obvious progress that I’ve made is the mechanical design that you can see on the various photos here.  The case is a pretty standard 115x90x55mm cast aluminum box for which the boards were designed right from the start. So if you’ve ever wondered about the peculiar shape of the display unit’s PCB you now know why. If I had made it rectangular it won’t fit.

I’ve milled the various holes and slots out of that cast case on a manual mill which was somewhat time consuming but a lot of fun. The slots at the back for the in and outputs have turned out particularly well I find. Hence the close-up 😉

I’ve also given away some boards over the months. A few of them went to an open-source project named MeshPoint where they are integrated into a WiFi hotspot designed for outdoor use in disaster areas, refugee camps and the like. The project is also on hackaday .io where it runs for this year’s hackaday prize.

Together with the bords that I’ve used myself for testing I’m slowly but surely running out of the protopac that I’d ordered from dirtypcbs.com. So I decided to make a few minor changes to the board resulting in Revision D. The changes are really slight and require no or only slight changes in the firmware.

By far the biggest change concerns the flash chip. As I’ve mentioned before, the last one was simply a bad design choice because it can’t do sector ereases. The Atmel AT45DB161E can do that and provides 16Mbit (i.e. 2 MB) of storage which is plenty for our application. This change of course does require firmware changes but since hardly any code for the flash chip has been written so far that’s not really an issue.

I’ve also included the surge suppression diodes that I removed when going from Rev B to Rev C. They are not really required but make the charger far more rugged against any spikes in the (particularly input) voltage. That also makes testing quite a bit safer so  I thought at least having the option of including them is well worth while.

The signals from the three temperature sensors now get RC filtered to hopefully solve some issues I’ve experienced with overly noisy measurements. Placing the capacitors close to the microcontroller was a major challenge but I think I did the best I could.

The other changes are really tiny. I’ve fixed a mistake on the silk screen, changed a number of footprints to make the parts easier to solder and added a diode from the USB bus to the output. That allows to power the charger via USB. That’s obviously only useful for testing and debugging but there it’s a nice feature.

If you want to check out the details, they are on github: https://github.com/soldernerd/SolarChargerHardware. Or click here for the next post in this series.

RX/TX Sequencer

Much like the beacon keyer presented here earlier, this RX/TX sequencer is a simple but useful little device. Its typical use is in ham radio applications when a separate power amplifier (PA) and/or a sensitive low-noise pre-amplifier (LNA) is used. Care has then to be take to safely transition between RX and TX states – and that’s where this sequencer comes in.

Why a sequencer?

There are many sequencer designs on the web, both analog (http://www.ifwtech.co.uk/g3sek/dx-book/sequencer/) and digital (http://www.mancuso.net.au/sequencer.html) There’s also a beautifully made but somewhat more involved design here: http://www.w6pql.com/relay_sequencer.htm. The links above (and many more) explain the purpose of (and need for) such a sequencer in quite some detail so I won’t repeat it all here.

soldernerd.com on YouTube

Maybe the best way to understand what this sequencer does is to see it in action. I’ve just yesterday started a YouTube channel to share that kind of videos. Here’s the link: https://www.youtube.com/watch?v=Ctxm0VxeM4g.

This is already Rev D

I have designed and built a number of sequencers over the years so this is already revision D. Unfortunately, I don’t seem to have photos of the first two versions.

Above is a photo of the previous (Rev C) version. Its design was very similar but quite a bit larger as the side-by-side comparison shows.

Input and Output

The sequencer presented here is of the digital variety, uses a 12V power supply and is fully reverse-polarity protected. It is controlled via a PPT input which is pulled high (to +5V) with a 10k resistor and active when pulled to ground.

That PPT input is both debounced as well as reasonably well protected. You can short it to the 12V supply without any adverse effects. Actually, anything in the plus/minus 50 volts range is fine.

Its outputs consist of 3  relay outputs. I’ve used DR-12V types. Those are single-pole, double throw (SPDT) reed relays. They are not inexpensive but both reliable and fast as well as nearly bounce-free.  Each relay has an LED next to it indicating its state and all three relevant relay contacts are accessible via the orange 200mil header.

PIC Microcontroller

The actual behaviour of the relays is controlled by a PIC16F18325 whose programming pins are accessible via the 5-pin, 100mil ICSP header.  Its pinout matches that of the popular PICKit3 programmer distributed by Microchip.

Speed control

How much delay should there be between switching the individual relays? The answer obviously depends on your lineup and that’s why you can control the speed via the on-board pot. The way I have it programmed the delay can be varied from 70 to 325 milliseconds.

Undervoltage lockout

 There were still some pins left on the microcontroller and the PIC comes with a 10bit ADC and voltage reference module. So I decided enable the PIC to measure the input voltage of nominally 12 volts. As it is now programmed, the sequencer will only start operation after the input voltage has consistently been above 11.1 volts for 1.6 seconds.

Github

As usual, all the files are on github:

Programmable LED Dimmer

Around one and a half years ago I’ve designed and built various LED dimmers for both white and RGB LEDs.  Then late last year someone approached me asking if I could make an RGB dimmer for him, too. But my designs were really tailored to their specific applications and built with home-made, i.e. milled PCBs which are time-consuming to make. So I decided to make a more universal version based on a proper, etched board which could be built in a small series and used for all kind of applications, both white and RGB. The result is this versatile, programmable 4-channel dimmer.

The design is based on my previous RGB dimmer but with a number of improvements.

soldernerd.com is now on YouTube

I’ve just uploaded a short video showing this device in action. Here’s the link: https://www.youtube.com/watch?v=ehZybd3Y2kc. This is only my second video so don’t expect miracles but I’d be interested to hear if you would like to see more videos in the future or if you prefer the traditional text and photos format.

Wide voltage range

It now operates from any voltage in the range of 6 to 26 volts as opposed to 12V only. In order to accomodate such a wide range of inupt voltages the regulated logic level voltage of 5V rather than the inupt voltage is now used to drive the mosfets.

Extremely low standby current

This 5V rail is generated by an LM2936 linear regulator with a very low quiscent current and shutdown input. That allows for a nice power saving feature for when all the outputs are off. After a few seconds of sitting idle the entire device powers itself off, i.e. it turns off the LM2936 thus only consuming 30 microamps (typ.) plus some leakage in the capacitors. So the device can stay connected to a battery for months without draining it. To wake it up one has to press any of the two push buttons.

Rotary encoder design options

Talking of push buttons. Like my previous RGB dimmer it features two rotary encoders with push buttons.

But now there are two different types of encoders that can be used.
The ones previously used with their axis perpendicular to the board and a different type where the rotary axis is parallel to the board.
And either type can be mounted on either side which gives you even more freedom for your physical design.

Perfectly debounced switch signals

As always with my designs, the signals from the encoders (six in total) are nicely debounced in hardware by running the RC-filtered signal through a 74HC14 schmitt-triggered hex inverter. So the singals are perfectly clean when they reach the microcontroller.

Noise immunity

With my last design I had experienced some difficulties with ground bounce or insufficient ground connections in general leading to less-than-reliable encoder readings. It’s always more difficult go ensure good, low impedance ground connections on those prototype boards since there are no plated-through holes and vias. On that prototype board the issue was solved by soldering in a few short pieces of wire where the ground connection needed improvement.

So with this new design I paid very close attention to ground. I spent a lot of time working on the board layout to ensure that everything is as noise immune as possible. I always use ground vias generously but here I really tried everything to get the best, shortest and lowest impedence ground connections could get. I’ve also used decoupling capacitors even more lavishly than I usually do.

New microcontroller

I’ve changed the microcontroller to a PIC16F18325 which is smaller and cheaper than the previously used PIC16F1936.
The 18325 has become my standard choicer whenever I need a low pin-count microcontroller. I particularly like its remappable pins which give a lot of freedom to simplify your signal routing on the PCB.

Smaller size and more outputs

The mosfet drivers are basically the same as before but now with non-inverting outputs: LM5111-1M. There are two of them for a total of 4 outputs compared to only 3 with the previous version.
They now drive much (physically) smaller but no less capable mosfets which allowed me to significantly downsize the whole board to 75x65mm.  The NXP BUK9Y12-40E are rated at 40 volts and offer an on-resistance of 12 milliohms (max @ 25 degrees ) with a 5V drive as we have here. Their large thermal pads a the bottom (NXP calls that package LFPAK) pass heat efficiently to the PCB which then serves as a heat sink. There is also a 30V version that offers even better performance but with a maximum input voltage of 26 volts I thought the 40V version is the safer choice.

As you can see, there’s plenty of capacity on the board. A total of 5 330uF 35V low ESR capacitors are placed in parallel in order to smooth out the PWMs inherent current ripple.

Software

So now we have a device with 2 rotary encoders and 4 outputs but it won’t do anything without software. There’s absolutely nothing hard-wired between the encoders and the outputs so we can program this device to behave in any way we like. That’s what makes it so flexible.

I have so far implemented two functions. The first is aimed at RGB LEDs and behaves exactly like my RGB dimmer. One encoder controls the brightness, pressing its button turns the outputs on and off. The other encoder controls the color, pressing its button toggles between white and color. The three outputs are 120 degrees out-of-phase which presents a more steady load to the power supply.

The second function is aimed at plain white LEDs. There are two pairs of outputs with output 1 & 2 forming a group and 3 & 4 the other. Each pair is controlled by one encoder. Turn it to control the brightness and press its button to turn the respective output pair on and off. The two outputs of any group are 180 degrees out-of-phase to smoothen the load. And since there is a 4th output it is easy to implement a case where there is an independent white channel.

With both functions, the entire device turns off after a pre-defined period of time (currently set at 3000ms) with all outputs off in order to save power. Before turning its own power supply off and hence losing all its data in RAM, the necessary parameters are saved to EEPROM. So the device remembers its last state and will power up the with the same (brightness, color and so on) settings it powered off with.

The switching frequency is 31.25kHz which is high enough to be entirely inaudible and the 10bit resolution gives you 1023 levels to finely control the brightness down to very low levels.

All the settings reside in a file named config.h. That is where you define the function you want the device to perform. The number of brightness levels and their respective values can simply be parameterized there. The same is true for the colors. You can also set the RGB values for neutral white. The seemingly obvious choice of 1023/1023/1023 often does not result in a pleasent white. For my LEDs I had to substantially reduce the green content but this, of course, depends on your particular choice of LEDs.

I currently have 3 devices productively deployed and they perform very nicely. Also, adding new functions is easy since all the heavy lifting like has already been done. It takes somethign like 100 lines of relatively simple code to implement a new function. No need to get involved with any registers and the like. So if you have any experience in C you should be totally fine programming this thing.

Visit github for code and Eagle files

Both the eagle files (including Gerbers) and code are on github:

Also want one?

I have some boards left and can make one for you, too. Fully built, tested and programmed to your needs. Cost is USD 65 payable via PayPal, including worldwide shipping. Simply contact me using this form.

Beacon Keyer

This is likely the first ham radio related project that I document here on this blog. But my very first PIC project was a beacon keyer that I made for my father, HB9BBD. That was was in 2013. A beacon keyer is a great project to get started with microcontrollers since it’s not much more than a fancy way of blinking an LED.

At that time I didn’t even use Eagle yet and so the layouts were based on a software called Sprint Layout. These were all very simple circuits, all based on a PIC16F688, and therefore perfectly suited for making some of my first homemade PCBs as well. The very early versions like the one in the picture above even used the DIP version of the PIC in a socket. All the resistors and capacitors are 1206 size not 0805 like of my later designs.

In fall last year, HB9MPU asked me if I could make some keyers for his new 10GHz beacon. That was a great oportunity to design a new one from scratch and this is what this post is about.

Requirements

These were the requirements:
– 12V operation
– Open drain outputs, i.e. a transistor to ground
– 2 outputs, one of them inverted

Microcontroller

I decided to use a PIC16F18325 this time. Like the 688 it is a 14-pin PIC but a much more recent addition to the PIC16 family. It’s fully featured with I2C, remappable pins, an onboard voltage reference, plenty of timers and a whole bunch of other features. And it’s widely available a very low price. So I tend to use this PIC whenever I need a low pin count micro somewhere. Like for my fan controller.

Outputs

Instead of using discrete transistors and protection diodes I’ve used a Texas TPL7407. That’s a 7-channel low-side driver, basically 7 mosfets to ground together with an on-board voltage regulator for the gate voltage and protection diodes all in a SOIC16 package. It sinks up to 600mA (with a maximum of 2A total) per channel and operates from 8.5 to 40 volts. Perfect to drive relays, small motors, powerful diodes or just about anything else that doesn’t require that much current. Some of you may be familiar with the ULN2003 which does the same thing but using bipolar transistors (as darlington pairs) instead of mosfets.

Power supply

The power supply is based on a Texas LM2931, basically a rugged LM7805 that operates all the way up to 26 volts and survives up to plus/minus 50V. While the LM2931 is reverse polarity protected, the diodes in the TPL7407 will short any negative input voltage to ground which is obviously a bad idea. I’ve added a 60V, 2A schottky diode at the input so the device is truely reverse protected. Minimum operating voltage of the TPL7407 (after a diode drop)  and maximum operating voltage of the LM2931 result in an input voltage range of the final device of 9 to 26 volts.

Speed control

There’s a small pot on the board that lets you control the speed of the keyer. The PIC measures the wiper voltage with its built-in 10-bit ADC and sets its speed accordingly.

Fan output

As mentioned, the TPL7407 has 7 channels but I only really needed two for the beacon keyer outputs, one normal and the other one inverted. The PIC also has an on-board voltage reference module and a temperature sensor so I decided to use all that functionality to add a fan controller. Beacons often have fans that run constantly even when there’s absolutely no need for cooling such as in winter which only wears out the fan’s bearings.

So the pic also measures the temperature and turns the fan output on and off according to software-defined threshold temperatures. Since the PIC’s temperature module is rather inacurate I’ve added an inexpensive but much more accurate LMT86 analog temperature sensor.

I’ve used 4 TPL7407 channels for the fan output so the current is limited by the total allowable current of 2 amps. Of course, you can also use this output to control a relay and use, for example, a 230V fan.

There are also 3 LEDs on the board so you can immediately see what’s going on.  And just in case you care, the board measures 45x45mm.

As always, programming is done with a PicKit3 or similar via a 100mil in-circuit programming header.

That’s pretty much all that is to say about this little device. As always, I appreciate any feedback and let me know if you need one of these.

And as always, everything from Eagle files to firmware is on Github:

DIY Electronics