Posts

Showing posts from February, 2021

Image footprints from drawings or QR code in KiCad

 Another FB conversation worth capturing the gist.  No Arduino content. My hand-wired prototype circuits get knocked around, and I made a couple of them into printed circuit boards (PCBs) for sturdiness.   They're one-offs, but maybe I'll want to make a couple more some day.   So I want to decorate them with images from photos or a QR code.  A chip on a board design has at least four representations. a line drawing showing all the pins, to be used as a symbol for the part in the electrical schematic drawing. a graphical "footprint" drawing showing the features it will need the PCB to provide.    There's a soldering "pad" for each pin, and their geometric arrangement, and maybe some paint marks for orienting the part the right way around. a "3D model" description so you can build a mechanical model of the assembled board. various electrical and logical models for simulating the behavior of the board. I'm using KiCad, which includes EEschema

Power up GPIO glitch

Image
 Here's an ATtiny85 driving a mosfet switch.   The LED draws too much current for the GPIO to drive it directly. I soldered this circuit up on a proto board, with pin 1 (gate) floating in the air connected to nothing.   When I tap the gate with my finger, the LED turns on, or off, or stays the same, seems kinda random.   But if I touch ground with my other hand the LED turns off every time.   What seems to be happening is the gate capacitance is large enough to hold whatever voltage it was driven to last.   There is 60 Hz hum on my finger, turning the transistor on and off.   The gate remembers what phase of the 60Hz hum it was at when we disconnected.   And it remembers it for at least several minutes. Now I connected gate to an ATtiny85 MCU general purpose IO pin.   On power up, the gate goes high, and there's nothing to push it low again.    The LED is on.  I can turn it on or off by touching a 100K resistor between the mosfet gate and +5 or ground.   Apparently the gate ca

Base resistors for bipolar transistors in Arduino applications.

Image
 Base resistors for bipolar transistors in Arduino applications. I'm going to disagree with the folks who are calculating the minimum base current you can get away with in the PN2222A BJT. In this application, you want the BJT either cut all the way off, or fully saturated conducting. Operating the BJT in its "active region" would be bad. For the off state, the AVR chip will drive well below 0.4V when sinking hardly any current, so you don't really need that external resistor. But it wouldn't hurt, for peace of mind. 15K would be enough. 2.2K would be ok, no need for anything lower. For saturation, the data sheet says 100 < gain < 300 and the test conditions go up to 50 mA base current. (They don't specify a maximum base current.) So I'm pretty safe shooting for 4 or 5 mA base current, and that would just barely saturate a gain=100 BJT when it's sinking 500 ma. In this design I don't see any advantage in a lower base current. Use a 1K resisto

Arduino musings. Things I learned. Newbie questions.

 This is a blog to collect the advice I've been sharing on Arduino forums.   I don't want Facebook to bury it and I don't want to own/manage a CMS just to put a blog in it.  Mostly it's been about how to use transistors as reliable switches.