A Smaller Xwhatsit

User avatar
wcass

06 Apr 2016, 03:31

I have been a hobby draftsman for about 30 years and have a fairly good understanding of plumbing, so I thought I could rearrange Xwhatsit’s Model F controller to make it more convenient to use in new capacitive keyboards; this despite having no electronics experience or training at all. I tried a bunch of EDA software and … let me just say that, IMHO DipTrace is vastly superior to KiCAD and is free for hobbyists (up to 300 pins).

Lucky for me, when I started this, Red had just published a DipTrace redesign version of Xwhatsit’s and I started with his schematic. Red had designed for 0.05” pitch ribbon cable; I considered that to be too fine for normal folks (like me) to hand solder, so my design goals were 0.1” pitch ribbon (easy to source) all in-line, expansion header on left or right side, and convenient mount holes – all in a nice small package so as to easily fit in small places.

Like Xwhatsit and Red, resistors and capacitors are 0805 (except for resistor packs). Red chose to replace the ultra fine pitch surface mount component shift register that Xwhatsit used with a larger (but functionally equivalent) footprint and that seemed like a reasonable replacement to me. I changed RP1 and RP2 for a single bussed resistor pack (RP12) and went for a much smaller crystal to save space. Changing the crystal meant that I had to change the value of the load capacitors slightly. I made a few assumptions that I believe to be true; the big one being that row order do not make any difference at all. This allows me to route the row traces with a little more freedom. The design I came up with is this …
xwhatsit3.JPG
xwhatsit3.JPG (291.15 KiB) Viewed 3009 times
xwhatsit4.jpg
xwhatsit4.jpg (73.92 KiB) Viewed 3009 times
I ordered PCBs from OshPark ($15 for 3 copies), a stencil from OshStencils ($7), and components for 3 copies from Digikey ($50). The stencil and components came quickly, the PCB took two weeks.
xwhatsit.jpg
xwhatsit.jpg (192.25 KiB) Viewed 3009 times
Notice the USB connector? Those holes are supposed to be slots (compare to design). Something that I missed when ordering the PCBs is that OshPark does not do slots and because of that, the connector side tabs don’t fit. The back tabs fit (but are off center), so I just bend the side tabs up, solder away, and hope that the pins solder OK.

For those of you who have not tried hot-plate reflow, you should. These video shows you how easy it is …
https://www.sparkfun.com/tutorials/59
https://www.youtube.com/watch?v=vLMTDwBuCiw

I use a Cuisinart CSK-150 that I picked up at Goodwill.
https://www.cuisinart.com/products/elec ... k-150.html

Anyway, this is what I ended up with. The problem is ... it is not working. When I connect a USB cable, it does not detect a new device, so I can't program the processor. It might just be the USB connector, but i'm not sure. Suggestions would be welcomed.
xwhatsit 002.jpg
xwhatsit 002.jpg (188.04 KiB) Viewed 3009 times

Ellipse

06 Apr 2016, 03:48

FYI all - I am hoping to use this redesigned controller with the F62/F77 keyboards.

wcass in Windows device manager does it say ATMega device when you plug it in?

Here are the troubleshooting/firmware installation steps I suggested to wcass over PM (I assume they did not work for wcass): To install the firmware using Windows (I don't know about the other OS installation procedures), after assembly you would install atmel flip, plug in the USB on the controller and plug it into the computer, then go to device manager, right click the "Atmel" device, click have disk, go to the Atmel Flip installation folder, allow searching subfolders, and install the driver, then load atmel Flip 3.4.7, click the chip icon "select a target device" and pick atmega32U2, click OK, then click the USB icon, click USB, click Open, then click File, Load HEX file and select the firmware hex file, then click run. After it says verified/pass then unplug the cable, wait 10 seconds, plug it back in, wait another 10 seconds, then open xwhatsit's newest version of the GUI (0.9.0?) and if it opens then you were successful.

User avatar
wcass

06 Apr 2016, 04:33

OS detects nothing when i plug it in. I was hoping that the macro picture would show a bridge somewhere or a flipped component. if there is one, i can't find it.

Engicoder

06 Apr 2016, 05:27

It looks like there is a via in the VCC line off the connector that goes to the ground plane on the back, but I may be mis-interpreting it.

User avatar
wcass

06 Apr 2016, 06:21

Engicoder wrote: It looks like there is a via in the VCC line off the connector that goes to the ground plane on the back, but I may be mis-interpreting it.
Thanks for looking Engicoder.
that is a silkscreen layer (green) dot to mark pin 1. sorry, the picture is not clearer.

User avatar
wcass

06 Apr 2016, 06:29

Does the ATmega32U2 chip come with/without a bootloader pre-loaded?
If so, how would i find out which i got?

From my DigiKey invoice ...
ATMEGA32U2-AU-ND
IC MCU 8BIT 32KB FLASH 32TQFP
HTSUS: 8542.31.0000
ECCN: EAR99
LEAD: LEAD FREE
ROHS: ROHS COMP
REACH: REACH UNAFFECTED DEC-2015
COUNTRY/ORIGIN: PHILIPPINES
CAGE: 1FN41

Engicoder

06 Apr 2016, 07:36

Yes, it is preprogrammed with the Atmel flavor DFU bootloader. According to Sections 25.2 and 23.6.3 of the datasheet, the HWBE (Hardware Boot Enable) fuse is programmed from the factory so that the bootloader can be hardware triggered by holding PD7 low on reset.

User avatar
vvp

06 Apr 2016, 11:39

If you can get to ISP leads then you can try to connect it to a programmer. I think (but I'm not sure) that the programmer will find the chip even if the external oscillator/crystal does not work. The communication with the programmer should happen before the chip switches to the external clock source. The only thing actually required to get the part recognized by the programmer is the power source for the chip. On the other side, USB requires the external oscillator working.

User avatar
flabbergast

06 Apr 2016, 12:28

I also think that if you can get an AVR ISP programmer connected, the crystal and fuses should not matter. However you've made some unusual choices in routing - 2x3 connectors looking like that are usually connected to the pins that allow you to hook up an ISP there; in your case they go to some random pins. Hooking up an ISP would require you to solder wires directly to MCU pins.

Crystal - I thought that the load caps should be physically as close to the crystal pins as possible (not sure how much does that matter - I guess the issue could be the traces' capacitance). Don't know whether this could be a problem.

If the bootloader is there (which I think it is - it seems to me that almost noone in the KB world ever flashes a bootloader, including hasu and bpiphany who do 32u2 MCUs), then I think it will run regardless of the HWBE fuse/HWB pin status, because the rest of the flash is blank. However you might want to pull HWB low just to be on the safe side.

User avatar
0100010

06 Apr 2016, 14:15

Ellipse wrote: FYI all - I am hoping to use this redesigned controller with the F62/F77 keyboards.
Why? Seems better to me to use a proven design, especially for touting a complete working product.

User avatar
0100010

06 Apr 2016, 14:17

Also remember that xwhatsit made his controller as wide as it was because of the original ribbon cable width and to fit at least one of the grounding / mount points.

User avatar
Ratfink

06 Apr 2016, 14:20

0100010 wrote:
Ellipse wrote: FYI all - I am hoping to use this redesigned controller with the F62/F77 keyboards.
Why? Seems better to me to use a proven design, especially for touting a complete working product.
Ellipse needs a smaller controller to fit inside the smaller case he's developing. If he can use the smaller controller for all of the 'boards he produces, there's one fewer part to change if you decide you want to switch to the smaller case.

User avatar
0100010

06 Apr 2016, 15:06

I would just have folded the controller under the bottom plate using slightly longer wires.

User avatar
vvp

06 Apr 2016, 18:23

flabbergast wrote: If the bootloader is there (which I think it is - it seems to me that almost noone in the KB world ever flashes a bootloader, including hasu and bpiphany who do 32u2 MCUs), then I think it will run regardless of the HWBE fuse/HWB pin status, because the rest of the flash is blank. However you might want to pull HWB low just to be on the safe side.
I'm not sure about ATmega bootloader but ATMEL ATXmega128a4u bootloader always enters the bootloader mode if the flash is blank. Regardless of everything else. I would expect ATmega to behave the same way.

User avatar
0100010

06 Apr 2016, 21:02

wcass wrote:
Engicoder wrote: It looks like there is a via in the VCC line off the connector that goes to the ground plane on the back, but I may be mis-interpreting it.
Thanks for looking Engicoder.
that is a silkscreen layer (green) dot to mark pin 1. sorry, the picture is not clearer.
What is C6 for?

User avatar
flabbergast

06 Apr 2016, 21:34

0100010 wrote: What is C6 for?
I'd guess it's one of the several contradictory options to connect the shield...

User avatar
wcass

06 Apr 2016, 22:32

My C6 is the same as what Xwhatsit's C6. Clips of his schematic and design below.
xwhatsit6.jpg
xwhatsit6.jpg (18.98 KiB) Viewed 2769 times
xwhatsit5.jpg
xwhatsit5.jpg (78.76 KiB) Viewed 2769 times

User avatar
0100010

06 Apr 2016, 22:54

If you look from the back edge of the USB connector - do the pins look like they are all in contact with the board? I've been staring at your layout and the populated PCB pics for a while now - I don't see anything wrong with it. I can't see what is under the USB connector though.

I am curious if your combining RP1 and RP2 will be OK from a capacitive scanning POV - but that wouldn't be affecting the USB to controller side of the circuit.

User avatar
vivalarevolución
formerly prdlm2009

07 Apr 2016, 00:00

This is wonderful. Thank the heavens for hobby plumbers.

User avatar
Ratfink

07 Apr 2016, 05:57

Just a note for when you order a revised version of this board: it's generally a bad idea to put vias inside of or directly adjacent to pads. Since they're plated-through holes, they'll get filled with solder, making you use more than you need to.

Ellipse

08 Apr 2016, 04:55

Here's a high res version of the original size xwhatsit controller for a visual comparison, split into two photos:
20141205_220518(0).jpg
20141205_220518(0).jpg (726.91 KiB) Viewed 2679 times
20141205_220526.jpg
20141205_220526.jpg (924.16 KiB) Viewed 2679 times

User avatar
hasu

08 Apr 2016, 05:22

Schematic and component values would be useful for inspection. Design files cannot be open in public? Even if it is DipTrace file it would be far easier than visual inspection with pics by eyeballs :D All of three PCBs were assembled and all of them don't work? If not the case you can solder another PCB carefully by hand and see what it happens.

User avatar
wcass

08 Apr 2016, 05:55

I'm using __red__'s schematic with just the 3 changes already listed (crystal, RP12, rearranged rows).
crystal is 535-12830-1-ND with caps at 30pF. did is miscalculate that value?
I'm going to swap the USB connector for one with no pins to see if that helps.

User avatar
hasu

08 Apr 2016, 10:07

I couldnn't find __red__'s schematic with my quick search. But assuming that __red__'s design were already confirmed and your skillet soldering works well(yes, it looks good to me) the changes you made seem to be first suspect to be examined.

From your PCB pics it seems your are using other smaller crystal thatn 535-12830-1-ND. Anyway, if you are actually using 30pF capacitors in your design it sounds to me too much for the cyrstal's load capacitance. From my experience, if you use wrong capacitors X'tal cannot oscillate and MCU doesn't boot sometime. If you have decent oscilloscope check if your X'tal really oscillates.

You can refer this note to understand Xtal's load capacitance. (To be honest I can't understand this thoroughly :D)
http://www.foxonline.com/pdfs/xtaldesignnotes.pdf

But just use this rules of thumb if you can't understand it.
https://blog.adafruit.com/2012/01/24/ch ... ur-design/

User avatar
flabbergast

08 Apr 2016, 10:13

I never really given the crystal load caps too much thought ... but just typing that crystal part number into google seems to tell me 18pF caps (e.g. digikey description) and 60Ohm feedback resistor (although I've never seen that one used in hobby projects).

EDIT: Yes, what I write above is wrong. hasu - thanks for the links!

User avatar
0100010

08 Apr 2016, 15:57

Both C1 and C2 are 30pF? If yes and assuming the PCB has a stray capacitance of 4pF gives:

CL = (C1 * C2) / (C1 + C2) + Cstray
((30*30)/(30+30))+4 = 19CL [close to the 18CL specified]

C1, C2 = 2*CL – 2*Cstray
Or, (2*18)-(2*4) = 28pF [close to the 30pF caps used]

If CS=3, then the 30pF and 18CL values are spot on
If CS=5, then you get 26pF and 20CL

Have an oscillator?

User avatar
wcass

08 Apr 2016, 22:22

__red__'s schematic and design. I'll send him a PM and ask him to take a look at this thread.
https://github.com/redvers/xwhatsit-diptrace

I don't know what the boards stray capacitance is. how would I best measure that?

Also, I have no scope. I'll

__red__

08 Apr 2016, 22:38

OH HAI.

I'm out and about right now and won't be back at my lab until later Wednesday evening. I actually dropped the project because there was a 3 week backlog on one of the components then got distracted by life.

I'll go ahead and re-order and should be able to build and test on Thursday (assuming I don't fall out of the sky on fire).

wcass - if you can't even program the micro-controller that's good news. Faults on that side of the board and a LOT easier to debug than the analog side.

User avatar
0100010

08 Apr 2016, 23:13

Without a scope to see what the rate is; I would just swag it.

You have a pair of 30pF caps now (C1=C2), and it appears not to be working (or in other words if CS was 3, then your 30pF should be good for an 18CL on the crystal). So I think we can ASS-U-ME that the CS =/= 3.

If we go with a CS=4, then since your C1=C2, and you have 18CL target :

CL = ((C1xC2)/(C1+C2))+CS

Since C1=C2 then the equation becomes:
CL=((C1xC1)/(2xC1)+CS
CL=(C1/2)+CS
Rearranging:
C1=2(CL-CS)

The crystal load capacitance is 18pF, and assuming CS=4pF, then:
C1=C2 = 2(18pF - 4pF) = 28pF

Said all that to say - can you try a pair of 0805 28pF caps? :D

Ellipse

15 Apr 2016, 06:20

So red how did your updated test go?

Post Reply

Return to “Workshop”