CMOS opened the door for many if not most of the properties needed for today’s highly integrated circuits and low power portable and mobile devices. This really couldn’t happen until the speeds and current drive capabilities of CMOS caught up to the other technologies, but catch up they did.
Nowadays CMOS Small Scale Integration (SSI) logic families, I.E. the gates used in external logic, offer very fast speeds and high current drive capability as well as supporting the low voltages found in modern designs. Likewise the Very Large Scale Integration (VLSI) designs, or Very Very Large Scale if you like counting the letter V when talking, are possible due to low power dissipation as well as other factors.
Microchips and integrated circuits are usually treated as black boxes; a signal goes in, and a signal goes out, and everything between those two events can be predicted and accurately modeled from a datasheet. Of course, the reality is much more complex, as any picture of a decapped IC will tell you.
The four transparent chips are beautiful works of engineering art, with the chip carriers, the bond wires, and the tiny square of silicon all visible to the naked eye. The educational set covers everything from resistors, n-channel and p-channel MOSFETS, diodes, and a ring oscillator circuit.
[Jim] has the chips and the datasheets, but doesn’t have the teaching materials and lab books that also came as a kit. In lieu of proper pedagogical technique, [Jim] ended up doing what any of us would: looking at it with a microscope and poking it with a multimeter and oscilloscope.
While the video below only goes over the first chip packed full of resistors, there are some interesting tidbits. One of the last experiments for this chip includes a hall effect sensor, in this case just a large, square resistor with multiple contacts around the perimeter. When a magnetic field is applied, some of the electrons are deflected, and with a careful experimental setup this magnetic field can be detected on an oscilloscope.
[Jim]’s video is a wonderful introduction to the black box of integrated circuits, but the existence of clear ICs leaves us wondering why these aren’t being made now. It’s too much to ask for Motorola to do a new run of these extremely educational chips, but why these chips are relegated to a closet in an engineering lab or the rare eBay auction is anyone’s guess.
The 6502 is a classic piece of computing history. Versions of this CPU were found in everything from the Apple ][, to the Nintendo Entertainment System, and the Commodore 64. The history of the 6502 doesn’t end with video games; for the last forty years, this CPU has found its way into industrial equipment, medical devices, and everything else that doesn’t need to be redesigned every two years. Combine the longevity of the 6502 with the fact an entire generation of developers first cut their teeth on 6502 assembly, and you have the makings of a classic microprocessor that will, I’m sure, still be relevant in another forty years.
The folks at WDC recently contacted me to see if I would give their hardware a close look, and after providing a few boards, this hardware proved to be both excellent. They’re great for educators adventurous enough to deviate from the Arduino, Processing, and Fritzing zeitgeist, and for anyone who wants to dip their toes into the world of 65xx development.
There comes a time when you need to wire up three, four, or more identical i2c devices to a common microcontroller. Maybe you’re thinking about driving 128 seven-segment displays with eight of those MAX6955 16-way digit drivers, or maybe you have a robot full of joints–each of which needs a BNO055 inertial sensor for angle estimation. (See above.) Crikey! In both of those cases, you’re best bet might be a schnazzy I²C device that can do most of the work for you. The problem? With a single I²C bus, there’s no standard way defined in the protocol for connecting two or more devices with the same address. Shoot! It would’ve been handy to wire up three BNO055 IMUs or eight MAX6955s and call it a day. Luckily, there’s a workaround.
We’ve seen some clever tricks in the past for solving this problem. [Marv G‘s] method involves toggling between a device’s default and alternate address with an external pin. This method, while clever, assumes that the device (a) has an alternate I²C address and (b) features an external pin for toggling that address.
I’ll introduce two additional methods for getting the conversation started between your micro’ and your suite of identical sensors. The first is “a neat trick,” but somewhat impractical for widespread use. The second is far more production-worthy–something you could gloat over and show off to your boss! Without further ado, let’s get started with Method 1.
Lastly, if you’d like to follow along, feel free to check out the source code on Github.
The Test Setup:
In both methods, I’m using the same sensor setup to check that each circuit behaves correctly. I happened to have a bunch of extra BMA180s on the bench, so I rolled out an example based on these chips. Back in the day, the BMA180 was a pretty common three-axis digital accelerometer. It has an I²C interface with two optional addresses. For the purpose of this example, I’m fixing them all with the same address. I’ve mounted three of these guys on mutually perpendicular axes of my acrylic “test cube,” and I’m reading each chip’s Z-axis. In this configuration I can easily pick out the gravity vector from the corresponding sensor as the data goes flying by my serial port window. If I can uniquely address each sensor and read the data, I’ve got a working circuit.
Method 1: Splicing Clocks into Chip-Selects
This method tips its hat towards SPI in that it behaves in an oddly similar fashion. If you’re feeling rusty on SPI, here’s a quick recap.
A Quick SPI Refreshment:
SPI, like I²C, is another protocol that shares both its clock and data lines with multiple slave devices. The difference, though, lies in the addressing scheme to talk to these devices that share the same bus. With SPI, while clock and data lines are shared, devices are addressed with separate chip-select (CS) lines.
The master microcontroller dedicates a unique output pin to each device (~SS1, ~SS2, and ~SS3 in this illustration). When the master micro’ wants to talk to a device, it asserts that device’s chip-select input pin by pulling it to logic LOW, and the conversation begins over the data bus. With the chip select LOW, the corresponding slave listens to the data on the bus. Meanwhile, all other devices ignore the conversation between the master and it’s chosen slave by keeping their bus pins in a high impedance state.
Giving I²C Its Own Chip-Selects:
With I²C, Clock (SCL) and Data (SDA) lines are still shared between all I2C slave devices, but the addressing scheme happens by sending a message heard by all devices on the bus. To single out one device on the shared bus, the master first passes down the address of the slave device it wants to talk to, after which that slave replies with an ACKnowledge, and all other slaves ignore the data that follows until both data transmission is complete and the bus is “released.”
Because we have the problem of multiple devices with shared addresses, in theory, all of these devices would reply when the master passes down their shared address, and there’s no way for the master to single out a single device. In reality, this behavior is undefined on the I²C protocol.
Yikes! Anything goes when we wander away from defined behavior, so we try to avoid these things in practice.
According to the I²C spec, It just so happens that an I²C slave device will ignore changes on the data line (SDA) provided that the clock line (SCL) is held high. In this method, I’ll “split” the SCL line into multiple SCL lines such that each shared I²C device gets its own SCL. By selectively rerouting the clock to each I²C device one-at-a-time, I’ve essentially turned the SCL line into a “chip select.”
To chop up that clock line, I’ll need a demultiplexer. A demultiplexer (or decoder) takes a logical input and reroutes it to one of several outputs based on the binary select lines.
I’ve dropped in the 74AC11138 eight-way demultiplexer for this task. It’s fast, capable of switching at megahertz rates, and its outputs default to logic HIGH. That second note is handy since idle SCL lines also default to logic HIGH.
The setup is shown in a simplified schematic above. In it, I’m using a Teensy 3.0 posing as the I²C bus master. To the right of the Teensy is the collection of identical chips, BMA180 accelerometers in this case. In the middle is the 74AC11138 eight-way demultiplexer.
Cons of this Method:
There’s a minor drawback with this technique, though, in that it doesn’t support I²C’s clock-stretching feature. Taking a step back, this method assumes that the SCL line is inherently unidirectional, controlled by only the I²C bus master. In other words, we’re making the assumption that data on the SCL line is only sent from master to slave and never the other way around. If your I²C slave devices implement clock-stretching, however, this assumption breaks down.
What is Clock Stretching?
Clock stretching is a method defined by the I²C protocol where the chip needs to “buy itself more time” and holds the SCL line low, hence, signalling to the master that it’s not ready for the upcoming data. In this scenario, the slave actively controls the SCL line, and it happens to be the only case where data moves up the SCL line from slave to master. In a setup with our demultiplexer between the master and our set of identical slaves, these slaves won’t be able to send back the clock-stretching signal to the master to indicate that they aren’t ready for data, if they happen to implement clock stretching. That said, clock stretching is a pretty rare feature among I²C-compatible devices, so this method is likely to work among a number of chips out now.
More Next Week
That’s all for Method 1. Thanks for tuning in, and check back next week for a slightly-more-professional method of tackling this same problem.
[Andrey Nechypurenko] has posted the second part of his robotics ground vehicle design guide. In his first post [Andrey] detailed the mechanical design decisions he faced. [Andrey] now begins covering the electrical components, starting with manual control using a standard radio control system. To accomplish this an RC system was used with an MD22 h-bridge driver and a picoUPS.
The MD22 is a neat motor control board which can take the PWM signals from the radio controller and use this to drive the DC motors. Optionally it can also use an I2C interface, giving a nice migration path to integrate with a microcontroller. Until that happens this can’t really be called a robot — its more of an RC vehicle. But the iterative design and build process he’s using is a good one!
The picoUPS provides on-board battery charging. Due to its UPS heritage it also allows the vehicle to be powered from an external supply, which has proved useful during development. Finally, a 5v regulator was required to supply the on-board digital logic. [Andrey] wanted a quick drop in solution with a budget large enough to allow for future expansion and went with the Pololu D15V35F5S3 which can supply 3.5 amps in a small and easy to use module.
After breadboarding the system [Andrey] fabricated a PCB to integrate all the components. The next step is to add sensors and and embedded computer to the platform.
While development boards for micro controllers are nothing ground breaking, they can be expensive, and often times overkill for what you’re doing when they try to put everything you might use … including the kitchen sink. when [Brian] noticed his projects were starting to use Microchip PIC24 more and more, the time came to have a dev board on hand.
The result is a small board with breakouts for USB, UART (via FTDI), of course tons of GPIO pins, and a socket which mates with a daughter board to swap out either a PIC24FJ128GC006, or a DSPIC33EP256MU806, with the potential for more. Also packed on the board is a power regulator system and dual crystals allowing full speed operation or power sipping modes.
Schematics and PCB layout are available (in Diptrace format) along with a board template file to use with MPLAB on github.com. Once you have everything together you will need a PIC programmer, [Brian] is using a trusty Microchip MPLAB ICD 3 programmer, but naturally, others are available.
Microchip recently announced a new development board of their own for the PIC16F series. The Curiosity board has built-in support for programming and debugging (no chipKIT needed). The engineer who designed that board, [John Mouton] is going to join us on July 30th for a live chat about the design process. We’re also going to be giving away some of the first boards to come off the production line… more about that this coming week.
[Andy Brown] is a prolific hacker and ends up building a lot of hardware. About a year back, he built a reflow oven controller. The board he designed used a large number of surface mount parts. This made it seem like a chicken or egg first problem. So he designed a new, easy to build, Android based reflow controller. The new version uses just one, easy to solder surface mount part. By putting in a cheap bluetooth module on the controller, he was able to write an app which could control the oven using any bluetooth enabled Android phone or tablet.
The single PCB is divided into the high voltage, mains powered section separated from the low power control electronics with cutout slots to take care of creepage issues. A BTA312-600B triac is used to switch the oven (load) on and off. The triac is controlled by a MOC3020M optically isolated triac driver, which in turn is driven by a micro controller via a transistor. The beefy 12Amp T0220 package triac is expected to get hot when switching the 1300W load, and [Andy] works through the math to show how he arrived at the heat sink selection. To ensure safety, he uses an isolated, fully encased step down transformer to provide power to the low voltage, control section. One of his requirements was to detect the zero cross over of the mains waveform. Using this signal allows him to turn on the triac for specific angle which can be varied by the micro controller depending on how much current the load requires. The rectified, but unfiltered ac signal is fed to the base of a transistor, which switches every time its base-emitter voltage threshold is reached.
For temperature measurement, [Andy] was using a type-k thermocouple and a Maxim MAX31855 thermocouple to digital converter. This part caused him quite some grief due to a bad production batch, and he found that out via the eevblog forum – eventually sorted out by ordering a replacement. Bluetooth functions are handled by the popular, and cheap, HC-06 module, which allows easy, automatic pairing. He prototyped the code on an ATmega328P, and then transferred it to an ATmega8 after optimising and whittling it down to under 7.5kb using the gcc optimiser. In order to make the board stand-alone, he also added a header for a cheap, Nokia 5110 display and a rotary encoder selector with switch. This allows local control without requiring an Android device.
Gerbers (zip file) for the board are available from his blog, and the ATmega code and Android app from his Github repo. The BoM list on his blog makes it easy to order out all the parts. In the hour long video after the break, [Andy] walks you through solder tip selection, tips for soldering SMD parts, the whole assembly process for the board and a demo. He then wraps it up by connecting the board to his oven, and showing it in action. He still needs to polish his PID tuning and algorithm, so add in your tips in the comments below.