Sunday, July 26, 2015

Controller check-out

I have FINALLY found my ISP programmer and been able to check out the postage stamp controller and made it to the typical embedded "Hello World" application of a blinking LED.



The small board in the upper left is an ESP8622 wifi module that is hanging out from a previous project.  I have flashed the ATMega328 part with the following typical example code:

void setup()
{
  pinMode(13, OUTPUT);
}

void loop() 
{
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);

}

The USBTinyISP programmer had no problem flashing the code to this part, but at initial blush, it appeared that nothing was working.  Then after a very long delay, I saw the LED turn on.  Reducing the delay values to 100 resulted in approximatly 1 second timing of the LED flashes.  So, it appears that the clock was not running at 16 MHz.

On a whim, I decided to flash the optiboot boot loader to the device and let the device reset and then erase the chip and reflash the test application above with no boot loader present.  This in fact fixed the problem.  

In looking at the datasheet, I see the following:



So, it appears that out of the box, a new ATMega328 is going to default to a 1 MHz system clock.  I will have to look at the optiboot code, but I am sure it is fiddling with the clock select bits which would explain the behavior I have seen.

In any event, I now have a tiny little microcontroller that needs no boot loader (saving that space in flash) and can be used for my projects that can use such a controller.  I have a couple updates that I need do to the PCB and will publish my updates on OSHPark where anyone can order the boards as desired.  $5 for 3 boards is a bargain.  More to the point is that I got something useful out of an attempt to learn a little more about KiCAD.

Saturday, July 18, 2015

Postage Stamp Micro-controller

In a previous post I described a little one inch square micro-controller based on the ATMega328 which I decided to build in order to learn KiCAD.  I have the boards back from OshPark.



To my way of thinking, it is a pretty good bargain to be able to obtain this lot of boards for the grand total of $10 plus shipping.  In any event, I have built up one of the units as seen below.


I have a couple of errors I will need to fix.  The first is that the row of header pins on the left and right side are not quite on 0.1 inch centers.  I plugged the headers into a prototype board while soldering and they both bend towards the centre of the board, so I need to space them a little closer together.  Oops...  The top and bottom headers are mounted on the top side of the board to allow plugging the board into a prototype board and still having all pins available.  I would expect to typically hard-wire the board into whatever circuit it will be employed in and then mount it down with double sided tape.  This one however is for bread-boarding.

The second error is that I used the wrong footprint for the thru-hole crystals that I have on hand and so it cannot sit completely down on the board.  Oh sigh...  Easy enough to fix however and I will make those updates before I publish the board at OshPark.com.

The ATMega328 chips are raw ones with no boot loader, so I will have to program them with the ISP header.  This can be done with another Arduino or any of the ISP programmers such as the USBTinyISP.  No boot loader is required on this device as there is no USB or other programming interface other than the ISP connector so therefore the entire flash is available for your code.




Thursday, July 2, 2015

KiCAD

Since being laid off at Dynon Avionics, I have been looking around at schematic capture and PCB CAD packages.  Chris at Contextual Electronics has encouraged me to try out KiCAD.  I decided to give it a go and design a small 1 square inch microcontroller board with a full-on ATMega 328 processor and the minimum circuitry necessary to build an (almost) UNO clone.  The "almost" part is the fact that there will be no USB port on the board and it will need be programmed using the ISP connector.

The circuit diagramme I decided on looks like this from KiCAD:



Nothing here that doesn't need to be here for a minimal controller.  I have the entire I/O pin set that can be found on an UNO, plus since I use the TQFP package, I have two additional analogue input pins.

The board layout is pretty dense at one inch square.  Here is the board layout showing all of the layers from KiCAD.  I am not terribly impressed with KiCAD's copper pour capabilities, at least as far as I have explored them, but what do you want for free, eh?



Producing the Gerber files was trivial and I zipped up the lot of them and shipped them off to OSHPark to be manufactured.  Here is the screen shot of their rendering of the gerber files for the front and back of the board.



So, now we wait for the little purple envelope to arrive.  Meanwhile I will collect up the set of parts to build a few of these up.  This was an experiment to enable me to learn KiCAD and at the same time to produce a useful gadget for other projects.  Once I have verified the functionality is correct, I will publish the OSHPark boards so others can order them directly if desired.  At $5 for 3 of them, they are pretty cheap.

Overall, I found KiCAD relatively easy to learn, once I got a couple of key concepts down.  The main one was that hot keys apply to whatever your mouse is hovering over.  I found myself wanting to click to select something before hitting a hot key and this lead to all sorts of grief.  Moving objects once they are placed also needs a lot of work.  Rubber-banding of traces pretty much sucks.  Once I figured out how to drag an object, the best that KiCAD could do is straight line connect all the existing traces.  This ends up being pretty much worthless for anything other than adjustments of a few centimetres and you end up deleting all the traces and redrawing them anyway.

Selection of wires in schematics needs an easy way to select only a line segment or the entire line without having to draw box around it.  When you move the line, it needs to rubber-band the end points.  Straightening out a series of segments needs to collapse them into one segment and it needs to be able to easily break a line segment in two without disconnecting them.  All of these comments also apply to traces in the PCB layout editor.

I did like that KiCAD included the ability to view gerber files, a comprehensive footprint editor as well as building the notion of hierarchical schematics into the product as a key feature.  I cannot however get the bill of materials functionality to work, so I must be doing something wrong.  Always more to learn. 

For a free, open-source product, it is quite compehensive and there are a lot of part footprints available out-of-box and from 3rd parties.  Overall, I would continue to use it for hobby projects.  I would need to try and build at least a four layer board to have an opinion about suitability for commercial projects.

Thursday, June 25, 2015

Change of status

Today I accepted a Firmware Engineer position with LOUD Technologies in Woodinville, WA working with the Mackie Digital Audio Mixing team.  I will be starting mid-July, so my job hunt status appears to be over.  Yay!  Check out their web site when you get a chance.  http://loudtechinc.com/

Wednesday, June 3, 2015

Diode Ring Mixer - UPDATED

In an attempt to firstly melt more solder than I have of late, and secondly to try and actually understand the operation of a mixer, I have decided to build one up from discrete components, including (gasp) winding my own transformers.

The rather rough diagramme of the circuit I propose to build looks something like this which is based on the fine design by Pete Juliano N6QW found here:



I found a few 1N6263 Schottky diodes in my junk box and out of the lot was able to find four that matched on the forward voltage drop to the millivolt level at 0V300.  A quick look around found a bit of PCB and a 1/4 inch sheet metal hole punch allowed me to create simple Manhattan pads.  Here is the layout at the start of the build with just the diodes installed.



I wound coils on FT37-43 cores.  I seem to be out of enameled wire, so I am going to try this with 30 gauge insulated wire-wrap wire as the number of turns is small, though the coils are trifilar.  I wound the trfilar wires together using a drill motor and then wound the three wires onto the core.  Ten turns, both coils are identical.



Separating the coil winding ends, I check continuity on them and mark them with a Sharpie (why is a dull felt pen called a Sharpie?) on each end of the wire with no mark, a single mark or a double mark.  The no mark wire will be the single coil while the one and two mark wires will be hooked in series (observing phasing).  The left side as drawn in the circuit above, will have a 100 ohm variable resistor at the centre tap of the transformer secondary to allow small balance adjustments.  As suggested by Pete Juliano N6QW, but not drawn above, I plan to also include a 39 ohm resistor that is switchable to ground from the centre tap in order to intentionally unbalance the mixer.  This is useful for injecting carrier for tune-up purposes for example.

The final build, minus the output filter can be seen below.  I hope to get out of interview preparation mode soon so that I can have some time to check this out.  The trim pot is a 100 ohm multi-turn pot to allow fine tuning of the balance.  Connecting the top of the 39 ohm resistor to ground will deliberately unbalance the mixer.



Finally got a chance to see if this little guy is mixing or not.  I set the 100 ohm multi-turn pot to the middle and attached the output of a 20 MHz crystal oscillator to it along with a signal generator output and had a look at the output on the spectrum analyzer.  Firstly, we needed some connectors.


I gave it 20 MHz on one port, 1 MHz on the other, both at 7 dBm and obtained the following output.  Both the sum and difference were within 0.08 dBm of each other.


So, we seem to be mixing and with proper IF filtering following, should be good to go.  Many thanks to Wayne NB6M for helping with the testing.



Tuesday, May 26, 2015

Version 1.0 of Si5351 Signal Generator

I have completed version 1.0 of my signal generator.  There will definitely be a revision as there are a number of things still to straighten out, but overall I am pleased with the result.

The 3D printed box with 20% fill on the box walls, was easy to drill, though I recommend a drill press.  I made the top cover thick enough that my controls (rotary encoder and switch) could be threaded into the plastic and no surface nuts required.  This seems to work well, though it remains to be seen how it holds up over time.


The point-to-point wiring inside is a pain in the tush.  Version B will definitely have a single PCB with all the components (display, power switch, rotary encoder, Trinket PRO, Si5351 and battery) plugged into it and mounted on stand-off spacers to the front panel.  I also definitely need to screw down the display.  The friction fit to the panel is good, but not good enough.  The picture below was taken before the Si5351 was installed.


So, overall I am pleased and look forward to using this new addition to my tools.

Monday, May 25, 2015

So, what do you think?

The second round of 3D printing I think is very close to what I need for this simple Si5351 signal generator.  The new mounting method for the display works well.  A little bit of plastic needed to be trimmed in order for the display to fit into place, but not bad.


The display fits very snugly so I will let it be for now.  I will likely drill out the corner holes and install screws to keep things in place.


The rotary encoder will  be mounted to the right of the display.  In reality, with a single line of code I can flip the rotation of the display by 180 degrees so it is easily adaptable to left or right handed operation.

I have been considering how to implement a single control interface using the rotary encoder and its built in push button.  I think that I will use a single press of the encoder knob to cycle between the three clocks.  The active clock is the one displayed in yellow.

Turning the rotary encoder will change the currently selected digit of the active frequency.  To change the tuning rate, I am considering rotating the encoder while holding the knob depressed to select which digit is changed by the encoder.

Otherwise, there will be a power switch and the three clock SMA output connectors.  I am unsure if I will mount them on the face along side of the display or if I will mount them on the side of the case.  I plan to use a small LiPo battery to power the entire device.

Overall, I am pleased with 3D printing as a medium for prototyping things like this case.  The aesthetics are not the greatest, but the strength of the case and the amount of accuracy of the print to the object design is quite good.  It will be interesting to see if my son's calibration efforts on the printer will have any effect on the aesthetics.