Using I2C Addresses as Chip Selects

I2C has a seven-bit address space, and you’re thinking “when do I ever need more than 127 devices on a pair of wires?” So you order up some parts only to find that they have one, two, or three user-configurable address pins for any given device type. And you need a bunch more than four or eight capacitive sensor buttons on your project. What do you do?

If you’re reader [Marv G], you think outside the box and realize that you can change the addresses on the fly by toggling address pins high and low with your microcontroller. That is, you can use a single I2C address pin for each device as a chip select signal just like you would have with SPI.

That’s it, really. [Marv G] goes through all of the other possible options in his writeup, and they’re all unsavory: multiple I2C busses, a multiplexer, buying different sensors, or changing micros. None of these are as straightforward as just running some more wires and toggling these with your micro.

We’d even go so far as to suggest that you could fan these chip select lines out with a shift register or one of those 1-of-N decoder chips, depending on how many I2C devices you need to chip-selectify. (We’re thinking 74HC595 or 74HC154.)

Along the way, we found this nice list of the number of address pins for a bunch of common peripherals provided by [LadyAda], in case you don’t believe us about how ubiquitous this problem is. How many devices on that list have one (1!!) address pin?

At the end of his post, [Marv G] asks if anyone else has thought of this chip select trick before. We hadn’t. Here’s your chance to play the smart-ass in the comments.

Build a Precision Voltage Reference Box

So you just scored a vintage piece of test gear, or maybe you just bought a fancy new DMM (Hmm…We love that new multimeter smell!) But can it read voltage accurately? How can you be sure? Well, that’s why you should build yourself a voltage reference box.

Youtuber [Scullcom’s] latest video has you covered. Wants some specs? Sure. How does a precision 10v and 5v output with only ±0.025% and an amazing 2.5ppm/°C sound? That’s very impress for something you can cobble together yourself.  We find it interesting that he actually uses some ebay parts to pull off this build. The LiPo battery, USB LiPo charging circuit, and boost regulator are all sourced from ebay. Not to worry though, as these parts are only used to supply power to a 15 volt linear regulator. The real magic happens in the Texas Instruments REF102 precision voltage reference. You give it a decently clean 12-36 volts, and it will give you a 10 volt reference out.  These amazing chips are able to obtain such precision in part because they are calibrated (or more specifically “laser trimmed”) from the factory. A secondary output of 5 volt is achieved by using a differential amplifier.

Warning: The video after the break is a bit on the long side(43 mins), so you might want to make some popcorn. But we find [Scullcom’s] teaching style to be lovely, and he does a wonderful job of explaining the project start to finish, soup to nuts. Continue reading “Build a Precision Voltage Reference Box”

The Oldland CPU 32-bit FPGA Core

Field Programmable Gate Arrays (FPGAs) let you program any logic you’d like onto a chip. You write your logic using a hardware description language, then flash it to the FPGA. You can even design your own processor and flash it to the chip.

That’s exactly what [jamieiles] has done with the Oldland CPU. It’s an open source 32 bit CPU core that you can synthesize for use on an FPGA. Not only can you browse through all the Verilog code in the Github repo, but there’s also a bunch of tools for working with this CPU core.

Included with the package is oldland-rtlsim, which lets you simulate the processor on a PC. The oldland-debug tool lets you connect to the processor for programming and debugging over JTAG. Finally, there’s a GNU toolchain port that lets you build C code for the device.

Going one step futher, [jamieiles] built a full SoC around the Oldland core. This has SPI, UART, timers, and more features you’d expect to find in a microcontroller. It can be flashed to the relatively cheap Terasic DE0-Nano board.

[jamieiles] has also ported u-boot to the processor, and the next thing on the list is the Linux kernel. If you’ve ever been interested in how CPUs actually work, this is a neat project to look through. If you want more open source CPU cores, check out OpenCores.

DIY Oscilloscope with a Scanning Laser

If you’ve ever used an old-school analog oscilloscope (an experience everyone should have!) you probably noticed that the trace is simply drawn by a beam that scans across the CRT at a constant rate, creating a straight line when there’s no signal. The input signal simply affects the y-component of the beam, deflecting it into the shape of your waveform. [Steve] wrote in to let us know about his home-built “oscilloscope” that works a lot like a simple analog oscilloscope, albeit with a laser instead of  a CRT.

[Steve]’s scope is built out of a hodgepodge of parts including Lego, an Erector set, LittleBits, and a Kano Computer (based on a Raspberry Pi). The Pi generates a PWM signal that controls the speed of a LittleBits motor. The motor is hooked up to a spinning mirror that sweeps the laser across some graph paper, creating a straight laser line.

After he got his sweep working, [Steve] took a small speaker and mounted a mirror to its cone. Next he mounted the speaker so the laser’s beam hits the mirror on the speaker, the spinning sweep mirror, and finally the graph paper display. The scope’s input signal (in this case, audio from a phone) is fed into the speaker which deflects the laser beam up and down as it is swept across the paper, forming a nice oscilloscope-like trace.

While [Steve]’s scope might not be incredibly usable in most cases, it’s still a great proof of concept and a good way to learn how old oscilloscopes work. Check out the video after the break to see the laser scope in action.

Continue reading “DIY Oscilloscope with a Scanning Laser”

How Cheap Is Cheap?

The Nordic Semiconductor nRF24L01 is the older sibling of the nRF24L01+ and is not recommended for new designs anymore. Sometimes, if you’re looking for a cheaper bargain, the older chip may the way to go. [necromant] recently got hold of a bunch of cheap nrf24l01 modules. How cheap ? Does $0.55 sound cheap enough?

Someone back east worked out how to cost-optimize cheap modules and make them even cheaper. At that price, the modules would have severe performance limitations, if they worked at all. [necromant] decided to take a look under the hood. First off, there’s no QFN package on the modules. Instead they contain a COB (chip on board) embedded in black epoxy. [necromant] guesses it’s most likely one of those fake ASICs under the epoxy with more power consumption and less sensitivity. But there’s a step further you can go in making it cheaper. He compared the modules to the reference schematics, and found several key components missing. A critical current set resistor is missing (unless it’s hiding under the epoxy). And many of the components on the transmit side are missing – which means signal power would be nowhere near close to the original modules.

The big question is if they work or not ? In one test, the radio did not work at all. In a different setup, it worked, albeit with very low signal quality. If you are in Moscow, and have access to 2.4Ghz RF analysis tools, [necromant] would like to hear from you, so he can look at the guts of these modules.

Thanks to [Andrew] for sending in this tip.

Killer USB Drive is Designed to Fry Laptops

[Dark Purple] recently heard a story about how someone stole a flash drive from a passenger on the subway. The thief plugged the flash drive into his computer and discovered that instead of containing any valuable data, it completely fried his computer. The fake flash drive apparently contained circuitry designed to break whatever computer it was plugged into. Since the concept sounded pretty amazing, [Dark Purple] set out to make his own computer-frying USB drive.

While any electrical port on a computer is a great entry point for potentially hazardous signals, USB is pretty well protected. If you short power and ground together, the port simply shuts off. Pass through a few kV of static electricity and TVS diodes safely shunt the power. Feed in an RF signal and the inline filtering beads dissipate most of the energy.

To get around or break through these protections, [Dark Purple]’s design uses an inverting DC-DC converter. The converter takes power from the USB port to charge a capacitor bank up to -110VDC. After the caps are charged, the converter shuts down and a transistor shunts the capacitor voltage to the data pins of the port. Once the caps are discharged, the supply fires back up and the cycle repeats until the computer is fried (typically as long as bus voltage is present). The combination of high voltage and high current is enough to defeat the small TVS diodes on the bus lines and successfully fry some sensitive components—and often the CPU. USB is typically integrated with the CPU in most modern laptops, which makes this attack very effective.

Thanks for the tip, [Pinner].

Design in Package Flexibility into Your Next PCB

To err is human.  And to order the wrong component foot print is just part of engineering. It happens to us all; You’re working hard to finish a design, you have PCBs on the way and you’re putting in your order into your favorite parts supplier. It’s late, and you’re tired. You hit submit, and breathe a sigh of relief. Little do you know that in about a week when everything arrives, that you’ll have ordered the wrong component package for your design.

Well, fear not. [David Cook] has a solution that could save your bacon. He shows you how to design multiple footprints into your board to avoid the most common mistakes such as voltage regulators with different pin-outs than expected. Other uses for the trick include, common trim pots with different pin spacing and a layout for decoupling caps that will fit both a 0.1″ and 0.2″ footprints.

We’ll file this under the “Why Didn’t I Think of That” category. It’s a super simple hack, but that’s what we love about it. We could see this being very handy for people who often scavenge parts. Also, for makers that sell just a bare PCBs (without parts) to those that want just a board. No, it won’t save you if your need an SMD and you mistakenly ordered a dip, but at the end of the day, it’s a nice trick to keep up your sleeve.  You might never know when you’ll need it.