USB" /> Microwave | An exercise in motivation

Archive for the ‘Microwave’ Category

Grideye USB

One of the key fea­tures of my microwave is Panasonic’s Grideye thermal sensor. This is a (rel­at­ively) low cost thermal sensor that I have placed at the top of the microwave to meas­ure the sur­face tem­per­at­ure of the food.

The sensor is an I2C device which requires a 5V or 3.3V sup­ply. Want­ing to keep everything rel­at­ively high level I am imple­ment­ing it as a USB device.

For the demo I used a Bus­Pir­ate as an I2C-USB bridge. This got me through the demo but the pro­to­cols com­bine very badly res­ult­ing in a max­imum frame rate of about 1fps. The high latency of USB com­mu­nic­a­tions com­bines with the chatty­ness of I2C caus­ing everything to be very slow. So a prac­tical imple­ment­a­tion can’t be a bridge, it must have some logic to con­trol the device and present a pro­cessed USB data stream.

There is an exist­ing one, Digikey has a break­out board that their Applic­a­tion Engin­eers developed. Sadly due to Panasonic’s lim­it­a­tions on dis­trib­ut­ing the GridEye sensor they only ship them within the US. The Applic­a­tion Engin­eers team runs in an open hard­ware man­ner, the pro­ject page for the break­out board includes the cir­cuit dia­gram and firm­ware code. I got in con­tact with the author, Chris Baird, and while he didn’t have any blank PCBs he could ship he was happy to share the ger­ber files so I could make my own.

The story doesn’t end here though, because a solid dose of Not-Invented-Here hit, jus­ti­fied by the twin desire to eval­u­ate KiCad and want­ing to imple­ment the USB Video pro­tocol, driven in part by an absurd desire to shovel yet another driver into the Linux Kernel.

As a nice bonus I reduced the cost, sig­ni­fic­ant com­pon­ents, exclud­ing the GridEye, cost $9.81 AUD for the Digikey board com­pared to $2.60 AUD for mine. Though that it no way com­pensates for the time spent and comes with the dis­claimer that the Digikey board actu­ally works.

All files for the design being dis­cussed are avail­able at https://​git​hub​.com/​l​o​d​/​g​r​i​d​e​y​e​_​u​s​b​_​e​l​e​c​t​r​o​n​ics.

Cir­cuit Design

My cir­cuit design is below, I took a rather dif­fer­ent approach to the Digikey board, wir­ing an Atmel AVR dir­ectly to the USB input. This will use V-USB, a soft­ware USB stack to com­mu­nic­ate. The ATTiny AVR used is cap­able of run­ning V-USB on it’s internal crys­tal, it should also have enough memory allow­ing me to do USB based reprogramming.

Eeschema circuit

The AVR must run off 5V in order to be fast enough to handle the USB com­mu­nic­a­tions. USB com­mu­nic­a­tions how­ever are a 3.3V sig­nal and while driv­ing it at 5V typ­ic­ally works it’s cer­tainly not a nice thing to do. The weak zen­ner diodes are a bid­irec­tional level con­ver­sion tech­nique.

The power net­work actu­ally allows for two dif­fer­ent voltage levels into the GridEye. It isn’t clear from the data­sheet what impact a dirty power sup­ply has, so I have fit­ted an LDO to cre­ate a smooth 3.3V sig­nal. There is also a 5V GridEye vari­ant (which I don’t cur­rently have) that could be run dir­ectly off the USB rail. To sup­port both cases I have an LDO designed in as well as pads for a zero ohm res­istor to bridge the rails, one or the other should be fitted.

The I2C bus uses an open-collector sig­nal so nicely adapts to whatever voltage the GridEye is powered on. Run­ning at 5V the AVR reads 2.5V as high, com­fort­ably sup­port­ing 3.3V communication.

I would have liked to have a spare IO to be able to dis­able the LDO in low power mode. How­ever the GridEye can be soft­ware con­figured into a low power state and the LDO does not con­sume much power when idle. I could repur­pose the reset line for the job but that has sig­ni­fic­ant downsides.

Single Sided PCB

Click image for inter­act­ive 3D model
Loading …

My first attempt at a PCB was a two layered single sided PCB, it is func­tional but not optim­ized as I decided the approach was wrong and cre­ated a double sided PCB for manufacturing.

It is a fairly long, simple, PCB with a simple flow left to right of the USB port, AVR chip and GridEye sensor.

I cre­ated two ground planes, a shield plane around the out­side which is con­nec­ted to the USB shield and the screw holes, it is designed to be con­nec­ted to the chassis. The cen­ter of the board has a stand­ard digital ground con­nec­ted to vari­ous com­pon­ents and the USB ground line. In my microwave sys­tem there should be a cent­ral (star) ground point, some­where else, which con­nects these two grounds. To provide flex­ib­il­ity, mainly for applic­a­tions without a metal chassis, there is an empty 0603 pad in each corner to bridge the two ground planes with either a capa­citor or a 0 ohm resistor .

After doing this lay­out I felt a two layer design would be much bet­ter. It would allow the board to be much smal­ler and I wanted the sensor to be more cent­ral. Later I learnt that the pro­to­type PCB man­u­fac­tur­ers all up their rates for boards over 5cm, so my 6cm board was fairly expens­ive. I swapped the large six pin con­nector with a Tag-Connect con­nector to try and be less ugly, with mixed success.

Two Sided PCB

Click image for inter­act­ive 3D model
Loading …

I star­ted this board more pro­fes­sion­ally, defin­ing a 3cm by 2cm board with M2 holes on each corner. It was a little bit of a struggle to get everything to fit nicely but that prob­ably means it was the cor­rect size.

My main con­cern with the new design is that one of the USB data lines is also used in the pro­gram­ming pro­cess. I tried to make it as short as pos­sible but the pro­gram­ming con­nector wouldn’t fit any­where but the far side of the board to the USB con­nector. So that line is a long stub dur­ing oper­a­tion, not a nice thing to do to an RF sig­nal. Anec­dotal evid­ence from for­ums sug­gests that I will get away with this but hav­ing the pro­gram­ming cable con­nec­ted will cause it to fail, I’m happy with that.

The Tag-Connect con­nector can be seen on the far side to the USB port. It is actu­ally just a care­fully arranged col­lec­tion of pads with holes to guide the plug. I haven’t used the Tag-Connect sys­tem before, I am attrac­ted to it for a num­ber of reas­ons. The foot­print is smal­ler, in board size, only con­sum­ing one layer and not hav­ing a high part per­man­ently attached. Being a lay­out of pads it is cheap per board. And for man­u­fac­tur­ing it is easy to design a pogo pin setup to hit the pads or use a bed of nails sys­tem. There is also a series of test points expos­ing the USB lines for manufacturing.

Sev­eral people have com­plained about the Tag-Connect rout­ing mean­ing that you take up as much board space as the stand­ard, lar­ger, con­nector. I cer­tainly found the rout­ing was annoy­ing, espe­cially with the holes at either end requir­ing lines to go the long way around. I cheated some­what by pla­cing vias on the pads, effect­ively mak­ing some of the pins through holes, this made rout­ing much easier for me. For a two layered board the Tag-Connect bene­fits are prob­ably mar­ginal, with more lay­ers the bene­fits would be add up rapidly.

Order­ing

An order has been placed at OSH­Park for both the Digikey board and mine, the pro­cess was remark­ably good, lots of feed­back as to what would be man­u­fac­tured as you pro­gressed. My board has an oval hole which OSH­Park doesn’t sup­port but I’ll fix that some­how after the board is delivered.

The Digikey board 20.35×22.91 mm (0.8×0.9 inches) and cost $1.20 USD per board.
My board is 30.02×20.02 mm (the 0.02mm is the cut line thick­ness) and cost $1.55 USD per board.

Within 24 hours both boards had been sent for fab­ric­a­tion, mine got a free upgrade to the spe­cial rush order stream.

I have ordered an 0603 res­istor and an 0603 capa­citor part book from Super Deal Tech­no­logy with some empty pages. The Digikey board uses 0804 parts (designed for old folks with fad­ing eye­sight) but I’ll just put 0603s onto the lar­ger pads. Part books are by far the best way to man­age SMD components.

The remain­ing parts have been ordered from Element14, Digikey was cheaper on the parts but more expens­ive with shipping.

Weekly Wrap 4 – 10 April 2016

Cheesecake danish

CSIRO notebook

Atten­ded a car acci­dent on Monday with the SES.

Baked my first suc­cess­ful Dan­ish using an online recipe after two failed attempts fol­low­ing a recipe book. We ate one and gave one away to my Grandfather.

Designed my first PCB using KiCad and wrote up the exper­i­ence.

Had my new engin­eer­ing note­books delivered, offi­cial CSIRO stock. I had a ter­rible time try­ing to find a decent book, my cur­rent one is an art book I picked up from Office­Works and it wasn’t ideal. The cur­rent book has a few pages left, I’ll prob­ably trans­ition over to a new one in a week or two.

Using KiCad

I have been exper­i­ment­ing this week with cir­cuit design and pcb lay­out tools. My exper­i­ence is with Altium but the price is rather hefty for my fairly simple require­ments and while I have used Altium for a few years I never actu­ally liked it, there are a lot of issues with the sys­tem. I con­sidered the vari­ous online tools and Eagle before decid­ing to give KiCad a go.

KiCad is an open source bundle of tools which has been rap­idly increas­ing in qual­ity over the last few years. CERN is provid­ing pro­fes­sional devel­op­ment sup­port and they have recently trans­ferred from a ‘build the source’ release struc­ture to stand­ard point releases.

I have played with KiCad for most of the week. It is good, I could do everything I needed to for the basic board I was doing, but some of it was a struggle. There are a lot of rough edges, how­ever the com­munity seems strong and most of the issues I encountered are in the pro­cess of being fixed.

There are sev­eral pro­jects under the KiCad ban­ner which loosely inter­op­er­ate, it seems they have had vary­ing amounts of coordin­a­tion over the years. Kicad itself is a pro­ject man­ager and applic­a­tion laucher. Ees­chema is the schem­atic design soft­ware. Pcb­new does the PCB lay­out. There are other tools I haven’t played with yet, such as a ger­ber viewer.

One of the issues is the cooper­a­tion between these applic­a­tions. For example the con­trols such as key­board short­cuts and mouse beha­viour are incon­sist­ent (This is flagged to be fixed by intro­du­cing a global short­cut man­ager). For a while (since fixed) pcb­new had pan­el­iz­a­tion fea­tures avail­able when launched stan­dalone but not when launched from within kicad . These sort of prob­lems mean that it feels more like using sev­eral dif­fer­ent pro­grams than a uni­fied suite.

Break­ing news

I have pub­lished a writeup of the board I designed, at https://​david​.tul​loh​.id​.au/​g​r​i​d​e​y​e​-​u​sb/.

Ees­chema

Eeschema screenshot

Eeschema is nice and familiar, you can place parts, connect wires, create named nets etc. I had a very simple five component board so had no need of the advanced features. However there was obvious functionality for buses and a fair bit of support for nested sheets. There is annotation tool to name your parts and a basic rule checker to catch mistakes.

Bonus

A nice bonus for Eeschema is the ability to have two names on a net. This is a bit controversial, Altium forbids it but I like it. Some times a line has two roles, such as being the MISO communication line during programming and the I2C interrupt line during normal operation. I like being able to create a named net for each role and connect both to the pin of the chip. The PCB layout program needs a single name, Eeschema handles this by arbitrarily picking one of them.

Missing Feature

Altium has a feature they call directives. This allows a pair of wires to be identified to be routed as a differential pair. You can also specify net classes, so as to specify increased track widths for the power rail or the required clearance on a high voltage track. KiCad does allow this to be done in Pcbnew but I feel the schematic, as the documentation for the design, should contain this information. This is particularly important if the layout and design are performed by different people.

Awkward

Eeschema's use of dragging with the left mouse button is odd. In most applications this would perform a group select, in eeschema it selects and begins to move the components. Copy/paste is done by holding down shift before doing a selection. The oddness and learning curve aside, this doesn't scale well. There is no way of selecting a group of objects so you can't do a group delete, you can't change the properties of a group or resize multiple wires together. Using the copy/paste you can't double check what you have selected before doing a copy, multiple pastes require the full process to be run again and you can't change sheets. The move is still the action regardless of the tool selected, so dragging with the wire tool actually does a select/move and placing a box like a sub-sheet must be done with two clicks not a drag.

I suspect the select behaviour will be changed in the same batch of work as the shortcut improvements.

Ugly

I should open by saying I couldn't really get my head around the schematic libraries. My understanding is that a library file can hold multiple components but I couldn't figure out how to put a second component into a library file. I did see notes suggesting that you merge two libraries by editing them by hand.

Several people have created their own tools to try and assist managing libraries. The existence of these tools indicates that many others have also encountered problems.

There is hidden magic behind the library process. For example to create a power component, basically a power net flag, the pin must be hidden. The pin still gets a wire connected to it but if it is not hidden it doesn't connect to the power net and you get unconnected errors when running the rule check. This isn't documented, the nice folks in the IRC channel explained it to me.

There is also documented hidden magic where some parts, fortunately none I used, have hidden VCC pins so they magically get the power rail without cluttering your schematic. Which is not so useful in the modern environment of multiple signal levels.

The developers are well aware of all of these issues, half the roadmap entries for eeschema are related to component editing. The plan seems to be to migrate the backend of the schematic library to the pcb library file format and work. Then build better editing tools on top. The PCB library tool is a significant step forward.

Pcbnew

Eeschema screenshot

It took me a while to real­ise that there are actu­ally three dif­fer­ent PCB pro­grams bundled into Pcb­new. They are lis­ted in the view menu as three dif­fer­ent dis­play modes: default, OpenGL, and Cairo. This is not, as you might expect, just a dif­fer­ent dis­play engine. Some fea­tures are not avail­able in all modes and some fea­tures work dif­fer­ently depend­ing which mode you are in. I found Cairo ran very slowly on my poor ancient laptop so I just used default and OpenGL.

Dif­fer­en­tial rout­ing is a rel­at­ively new fea­ture and is only imple­men­ted in OpenGL. In the default view the fea­ture on the menu is simply dis­abled, grayed out, no feed­back is provided as to how to enable it.

There are other, lesser issues:

  • In GL mode the scroll bar arrows don’t work, drag­ging does.
  • Rub­ber band drag mode only works in default mode.
  • In nor­mal mode delet­ing a track deletes the attached via, in GL mode it does not.
  • In nor­mal mode the start track short­cut starts a track imme­di­ately, in GL mode it waits for a click.

There is a 3D model fea­ture which uses VRML world files for each part. How­ever it only sup­ports the sub­set gen­er­ated by wings3d, more com­plex files silently fail. Extend­ing this to other model types is on the roadmap.

Some other stuff feels a bit incomplete:

  • Hid­ing a cop­per layer still shows the pads.
  • There is a “Hide all cop­per lay­ers but act­ive” option for single sided work but it doesn’t hide the other side’s silkscreen.
  • The rule-check doesn’t enforce track width.

Finally the lib­rary man­age­ment is bet­ter than Eescheema’s but still needs a lot of work.

  • Rel­at­ive paths require manu­ally using an envir­on­ment vari­able, which was lis­ted in the Ees­chema lib­rary man­ager but not Pcbnew’s.
  • There is a plu­gin to add git­hub based repos­it­or­ies, but the option is lis­ted even if the plu­gin is not installed.
  • There is a plu­gin to add git­hub based repos­it­or­ies, not git based, it uses a git­hub webpage URL.
  • Adding a lib­rary doesn’t check that the lib­rary exists, works or is valid. An error is shown later when you try and use it.
Return top