KoblentsBlog Photography
Contact About
Published Sep 26, 2013
This week in design: second SMD soldering tutorial revision, and a first revision of a PIC USB testbench.
SMD soldering tutorial v2 (PIC12F615)
SMD Soldering Tut v2 front SMD Soldering Tut v2 back
PIC USB test harness v1 (PIC16F1455)
PIC USB harness v1 front PIC USB harness v1 back
 
Published Sep 20, 2013
I'm working on a couple designs that I want to be battery powered and USB-rechargeable. I'm not excellent with low power design, and some designs simply use a relatively high amount of power when active (on the order of 50 - 100mW), so no matter how good my standby power is (on the order of 100uW), I need a battery with decent reserves. It also needs to be small.
Therefore, the coin cell. Pretty much no other option that I know of.
Unfortunately, Digikey was sparse. They had the right size, capacity, and max discharge values for non-rechargeables.
A bit of googling, however, found me with the LIR2450 (lithium rechargeable version of the CR2450), as well as not one but two reference designs: Chasing 'trons (found via Hackaday, which misspelled it as the LR2450), and the fabrickit Coin Cell Brick via sparkfun.
The LIR2450 has what I need: relatively small height, a 100mAh nominal (120mAh typical) capacity, and at least a 50mA discharge rate. Perfect. Buy it on Ebay.
LIR2450
 
Published Sep 20, 2013
I recently got back the first revision of a circuit board meant to teach surface mount soldering and embedded programming. I then realized the board posed a hurdle to the learning process I could overcome for $4.
Back when dinosaurs roamed the earth, and it was only three years ago, surface-mount sockets were either prohibitively expensive or my google-fu was poor. The best prices for sockets I could find started at the high double digits, and went deep into triple digits. Today, you can buy a SOIC-8 socket for $2.50 and a SOIC-16 socket for $8. (Technically, the SOIC-8 socket is a SOIC-16 socket with half the pins unusable, so I opted for the SOIC-16 socket, which also does SO8, 10, 12, and SO14). This is incredible, and it means that I can preprogram surface mount microcontrollers before I or someone else solders them.
This is supremely important to me, because I believe the number one killer of people's interest in hobby electronics is the lack of feedback. When I compile a program, and there's an issue, the compiler tells me! (Of course, if it's GCC and C++, it tells me three pages of expanded template details, and I have no idea what the real error is.) If there's a runtime issue, I may get an ugly segfault, but I can debug with gdb and/or I can use print statements. However, when we play with hardware, we're lucky to get intelligent errors.
Why is the Arduino so popular? It's popular because it just works. We plug it in, and we load test code on it, and the LED blinks. We program our own thing, and when it doesn't work, we write debug data to serial, and we get it working.
When a bare chip doesn't work, however, it just doesn't work. Your code compiled, and the programmer says the chip is loaded, but nothing is blinking. If you're good at this, you've got debug and emulation utilities set up, you step through your program and find the issue, you can write data to serial or USB. If you're just starting out, it just sits there, a black piece of plastic and metal, mocking you.
 
Published Sep 20, 2013
My first Osh Park design is very simple. I made a small learn-surface-mount-soldering tutorial:
  • PIC12F615 - 8 pin SOIC
  • Two 1k resistors - 1206
  • Two LEDs - 1206
  • Debounce capacitor - 1206
  • Classic PCB pushbutton - through hole
  • Two 4-pin headers, one on each side, for the PIC breakout
  • One 6-pin ICSP (in-circuit serial programmer) header for PIC programming
So the total tally is: one SO-8, five 1206, and the rest through-hole. My next article will be about actually assembling, testing, and programming the little guy. But first, I'll go over issues I already see, and planned changes.
 
Published Sep 20, 2013
If there's anything I love more than getting first prototype boards, it's getting cheap first prototype boards. I recently put in two different orders, one to Seeedstudio Fusion (with shipping, $15 for ten 5x5cm boards, and $25 for five 10x10cm boards are the best deals), and one to Osh Park (three copies, $5 per square inch of design).
Obviously Seeedstudio is better for larger boards, and Osh Park is better for smaller boards. This article is about Osh Park and my experience with them.
My first Osh Park design is a surface mount tutorial - a PIC, a couple LEDs, a pushbutton, and breakout and programming headers. Two layer board, 0.7" by 0.75" for a total of $2.65 for three boards with free shipping. (By the way, Osh Park is literally a 20 minute drive from me, so I'm considering emailing the guy to see if I can't pick up boards in person.)
So exciting!
Board 1 front Board 1 back
 
Published Sep 12, 2013
I recently got a free copy of Windows 8 through my university. The desktop interface is better than Windows 7 (except for the insane touchpad / mouse regression - a touch-optimized OS shouldn't break my mouse and touchpad!). But more importantly, there are still many programs that only work on Windows. My hard drive is big so free is free.
Unfortunately, Windows overwrote the boot sector. This isn't a very big deal. The first time I saw my computer not boot, and then drop down into text GRUB, I sweated. This time, things were as smooth as butter. I'll tell you what to do, but first I'll list the important details of my setup (which might be too much info - Windows 8 and Linux Mint 14 are the only actually important bits):
 
Published Sep 9, 2013
Bitwise operators are powerful, fast, and direct. They do precisely what they should do.
They're also seen by some misguided souls as an 'elite' way of writing code; a way to tell everyone that the author is an expert in all things programming. This is a common trap to fall into.
Here are my rules for when to use bitwise operators. This is by no means a finished document.
Most importantly: do you, the programmer, understand bitwise operators? If you don't fully understand what you're doing or why you're doing it, you're writing clever code, and you're doomed to debugging hell. If you're copying someone else's code, this is doubly true. Only write what you can understand! This is a universal rule.
 
Published Sep 9, 2013
There are a few pitfalls in shifting. The issues appear when:
  • Programmer is unclear on logical versus arithmetic shifting
  • Programmer uses signed types
  • Programmer uses shifting to optimize divide/multiply by 2
The short version is this:
  • A left shift is a multiplication by 2n (with possible overflow.)
  • A right shift is division by 2n with caveats and pitfalls.
  • For left shifting, arithmetic and logical shifting is identical.
  • Arithmetic right shift will shift, then pad MSB with previous MSB.
  • Logical right shift will shift, then pad MSB with 0.
  • For unsigned values, arithmetic and logical right shift is identical.
  • For positive signed values, arithmetic and logical right shift is identical.
  • For negative values, arithmetic right shift is division by 2n rounding down.
  • For negative values, signed division by 2n rounds to 0.
  • Right shift for C is logical or arithmetic depending on the compiler behavior.
 
Published Sep 9, 2013
This article will deal with an introduction to bitwise operators, written in the way that most makes sense to me, from a hardware and low-level software point of view. The basics apply to anyone, though those working in higher-level languages may only care about how to use them and nothing more in depth.
There are a lot of bitwise operators. They are important in programming and represent essentially all combinational digital logic. Bitwise operators operate on the individual bits of a variable. For example, where you see the number 20 (stored as an unsigned byte), a bitwise operator sees 0x14 or 0b00010100. It doesn't care about the integer 20; it cares about the sequence of bits.
	AND operator: 1 if both bits are 1, 0 otherwise
	A | B | A AND B
	0 | 0 | 0
	0 | 1 | 0
	1 | 0 | 0
	1 | 1 | 1

	AND usage:
	Let A = 5		A = 0b101
Let B = 3 B = 0b011
A AND B 101 AND 011 --- RESULT 001 A & B == 0b001 == 1 base 10
 
 
« October 2013 August 2013 »
© Copyright Koblents.com, 2012-2024