Just because you don’t believe…

There’s something that just annoys me about both sides of the political aisle: disbelief.

From the right you have the Republicans thinking that is you just don’t believe in climate change enough then it won’t happen. If you keep beating the drum you might convince people of your views, but reality is something that doesn’t require believing in.

On the left you have a disbelief in things like macro economics. At once you have people asking for higher minimum wages and affordable (and nice!) housing, but no one seems to think about the larger picture. You can’t just legislate “affordable housing” because whatever rules and regulations you propose will generally backfire. Just because you truly  believe that you can legislate a better world doesn’t make it so.

A perfect example is in Seattle we have cries for “affordable housing.” So the city passes zoning to allow for small apartments (with corresponding smaller rent). Developers jump on this, then people complain that what’s affordable isn’t good enough for them.

<shrug/>

You need to look at the world with open eyes and not try to color it with your own expectations.

Logic Analyzer++

I purchased the Saleae Logic Pro 16 back last year Actually I pre-ordered it and it arrived in late summer of last year.

Now I’m really rather pleased with it.  :-D

There’s something cool about being able to look at not just a tiny sliver of time that you get with a standard oscilloscope, but have many seconds worth of capture.

Screen Shot 2015-05-20 at 10.07.41 PM-X3.png

That up there is 45 seconds with the digital recorded at 100MHz. I recorded the analog at 5k since it’s not super critical.

So I can look at that or zoom in a just a slice:

The amount of cool this is amazing. And it’s not too expensive either

If you want do download their viewer I’m pretty sure you can load up by trace to look at it. Obviously you can’t capture anything without their hardware.

Take a look here: 16-port(ish) Trace. You’ll need to get the software to look at it which you can get from Saleae.

Glitchy

Playing around with my setup I wanted to get a nice screenshot and log of the I2C chatter including the initialization sequence.

Here’s the thing. Every time I got things hooked up the system stopped.

Eh?

I eventually narrowed it down to connecting anything to the TX pin of the micro controller it seemed to lock up.

All I can think of is that the added capacitance of the lead can be causing problems?

Strange.

Even stranger is that it’s just intermittent.

Update!

So I tried again with a different Arduino. When I wrote the stuff above I was using a pretty well hardened Ruggeduino. I swapping in an off-brand OSepp board and suddenly things started working.

So the plot thickens.

What’s different between the TX output stage between the two… next time.

It lives!

The pile of parts is charging up an iPad!

Basically you have the power going to the charge switch (square chip second from the right) to the USB port with the embedded sense resistor. The charge controller (all the way on the right) is letting the iPad know it’s allowed to draw 2.1A. The sense resistor’s voltage is going to the sense amplifier (all the way on the left). That, in turn, is going to the analog to digital converter (ADC) on top.

The ADC’s output goes over I2C to the micro controller (an Arduino in this case) that’s monitoring the charging.

That gets sent over serial to — well — nothing at the moment. But the scope is there monitoring it none-the-less.

The ASCII is the output of the ADC in text.

With the 10mΩ sense resistor and the 100 V/V amplifier the result is 1V/A at the input of the ADC. This is convenient because the unscaled value of the ADC is in mA.

Above (take a minute or two after the multimeter shot) is reading 1551mA — or 1.551A… which is pretty darn close to the multimeter output!

All that’s left to do is hook up the IO expander (that was blinking the LED before) and have that control the power switch and read any faults.

Then… then I have to build a circuit board.  :-)  Then maybe launch a kickstarter or something.

Speaking of boards — I came to a realization today. I was planning on building a modular system before, but I think I was overthinking things. I was thinking of spinning multiple versions of the board depending on how many ports are needed. An easier way is to build a master board with an I2C mux (multiplexer) and have that just chain to sister boards. This way I can have one board and optionally populate the mux and associated circuits or not. Having one board definitely makes thing cheaper.

Learning — Trial and Iteration

I’ve been working on the USB charger project in force over the weekend and I’ve made some good progress. It’s not completely prototyped, but all the parts that I need (except one, but it’s almost a passive part) have been made to show signs of life.

But here’s the thing… sometimes you need to try something only to have it fail. Then debug it and make it better the next time around.

Take one of the simplest parts of the entire project: the current sense resistor.

All it is is 0.01Ω resistor placed in series with the power supply to the USB. That tiny resistor will drop a tiny amount of voltage that will be sensed (hence: current sense resistor) to determine how much current (ergo: power) is being drawn.

So, for the example of 5V (USB supply voltage) and 1A (iPhone charging) you’ll get a 0.01V across the resistor. It’s not a lot, but it’s enough that once it’s amplified it’s perfect for the D/A convertor.

The first one I built was pretty janky.

It had male connectors on the top which is annoying to use and it seemed to have too much wire.

I had an idea — just slap on another pin and viola:

(And also make it double-wide)

It looks neater and it makes breadboarding easier.

Except it gives the wrong result.

At the current-sense it was showing 0.015V.

?

That’s when I realized that this was with a 1A load.

The addition of the connection back to the breadboard was adding another 0.005Ω in series with the already in-series resistor causing an addition voltage drop.

So I made up another another one… this was a combo of both the first and second ones…

That fixed things right up.

Basically I wired it up with a Kelvin connection and it was all good.

Since there’s almost no current going into the sense amp there’s virtually no voltage drop in the sense direction.

I guess it’s something that I had to spend a few bucks on for the parts to learn that lesson C’est la vie.

And don’t get me started on the resistor I blew.  :-/

Surface mount

I’ve always been really hesitant to get into surface mount components in electronics. It’s something that seems so incredibly fiddly that I would never would be able to get things done reliably — or have a good time getting to that point.

The thing is I’ve been playing around with it lately and I have been having fun with it.

So much is having the right tools for the job. So often that’s the case though.

With a good soldering iron (the Hakko 951 I wrote about earlier) and some good magnifiers it went from daunting to something that I’m enjoying.

Who would have thought that soldering on an 0603 part would be easy? 0805 seems big now. heh. Just a few weeks ago it was unbearably small.

Now I just need to get a goodly supply of protoboards and I’ll be set!  :-P

The big 4 – 0

No. Not the age. Been there, done that.

I started this whole weight loss thing when I saw my scale read 216-something back in October or November. Today (after a workout, admittedly): 175.7.

I’m not done yet; I have around six pounds to go.

But it’s a milestone. A big one.

I’ve lost 40 pounds (graphic above starts me at 215.6 — I was being optimistic at the time to make me feel better).

Not earth-shattering. Nothing huge. No deep thoughts today. No, it doesn’t change things. It doesn’t make me a better person — perhaps a healthier one though.

Just feeling a bit proud.

One with the machine

Today was one of those days. Those days when things just keep getting thrown at you. Things wind up stacking up in your head like the windows on the screen as you try to dispatch all the interruptions.

When I went to work I rode to the office in a bare drizzle. At lunch I wandered down to The Market to pick up some tea from the tea mongers at Perennial Tea Room. (What is someone who sells tea called?) I walked back to the office in an overcast that looked like it might spit at you at any moment.

Eventually I left in what had turned into a bright sunshiny afternoon.

Normally I’m riding my bike.

Today things just morphed a bit.

It felt like I was just floating down the road. My eyes set on wide angle instead of focused intently ahead. I was aware of my vulnerability looking at everyone else in their rolling boxes. I was both aware of that as I was just feeling alive.

It was as though the bike lent me some of her strength.

The stress of the day somehow melted away as the notion of the motorcycle as transportation melted away in a blur of the cityscape. The idea transformed into a simple oneness with the machine.

And life is good.

Sports Anemia

Yesterday I gave blood with Bloodworks Northwest. The last time I tried to give blood, around six or seven weeks ago, I was turned away. My hematocrit was too low — I think it was sitting at 28. Normal is 45-ish for men. Anything under 35 (if I recall correctly) and they don’t want to take your blood.

At first I was rather concerned. Anemia is a problem.

Then I started digging into some research on it.

I’ve never had a problem with my blood count before and suddenly things were low. What changed?

Exercise. Lots of it.

At the time (March) I was around five weeks into my workouts. Not just any workout, but some pretty strenuous workouts. And it was pretty sudden.

It turns out that starting to exercise can cause what looks like anemia — even though there aren’t any symptoms. It’s basically caused by having more plasma volume than normal. After a while things even out a bit — like they did for me.

My hematocrit level yesterday was 40. Back in the normal range.

Oh, and my blood pressure was 102/72.  :-D  W0ot!

And I managed to give a pint of blood in less than five minutes. 4:55 according to the clock on the computer. But I had to be shown up by another George across the aisle: 4:19. Bastard.

Blinking LEDs the hard way

Somewhere buried here are a couple of boards:

Basically, what we have going on is this chip being controlled by an I2C bus:

This is the PCA9505 from NXP which is nothing more than a 40-pin IO expander.

I could have blinked the LED from the Arduino itself, but since I needed a whole lot more IOs for the USB charger I needed to have a play around with one of these.

Which brings us to the board you’re seeing there.

The pins on that chip are 0.5mm on centers.  :-)  Hand soldered. For scale you can see the pin headers on the top-left. Those pins are all 0.1″ spacing.

I soldered this up on a SchmartBoard which alleges you can solder things easier by “pushing” the solder along each trace which is slightly routed out.

I had better luck just simply drag soldering these things.

The back side is where I dealt with the power and ground connections…

The really cool thing is looking at the scope and seeing the result of code that’s running on the Arduino controlling the show.

And here’s the code… too simple.

#include <Wire.h> 

void setup() {
 Wire.begin();
 Wire.beginTransmission(0x20);
 Wire.write(0x18);
 Wire.write(0x00);
 Wire.endTransmission();
}

void loop() {
 Wire.beginTransmission(0x20);
 Wire.write(0x08);
 Wire.write(0xff);
 Wire.endTransmission();

 delay(20);

 Wire.beginTransmission(0x20);
 Wire.write(0x08);
 Wire.write(0x00);
 Wire.endTransmission();

 delay(20);
}

The part you’re seeing on the scope is the first bit of the loop() up there. It’s turning on pin 1 which, in turn, turns on the LED. The yellow and blue traces are the I2C bus doing its thing and the purple is the LED turning on in response to it.

Register 0x18 is setting the IO config register for port 0 to all outputs. Writing to register 0x08 is just setting the outputs for that bank of (now configured) outputs. Essentially I’m toggling the entire bank because I’m being lazy and couldn’t be bothered to see what is the LSB. (Yes, it seems that 0x01 is IO0_0 — pin 3 — on the data sheet)

Fun stuff.  :-D

%d bloggers like this: