Archive for the 'Bit Bucket' Category
Identify the Mystery Components
I’m planning to do a partial capacitor replacement on the power supply of my old Macintosh IIsi computer. After 25+ years, these capacitors aren’t in the best condition, and the PSU doesn’t work correctly anymore. When plugged in, it makes odd clicking sounds for a few seconds, then does nothing, and the computer won’t boot. Occasionally if I plug it in, unplug it, plug it in again, and say some magic words, I can get the computer to boot. But it’s clearly on its last legs, and the research I’ve done says replacing a few key capacitors will likely fix it.
After dismantling the PSU and removing its circuit board, I was surprised by some of the components I found inside. I’ve never looked inside a power supply before, so this was all new to me.
In the center is a relay. I’m not sure why there’s a relay inside a PSU, but there it is. At right is probably a transformer? It has some exposed wire windings, and is located close to where 110V AC comes in, so I assume that’s it. At left is… something. A capacitor? It looks like a rolled up length of plasticized paper, coated in oil.
Here’s a closer look at the mystery capacitor thing.
On the other side of the PSU circuit board are two white plastic towers. They look like they might be removable covers. What are these, and what mysteries do they hide?
At the end of the board opposite the AC power connection, there are two cylindrical components that look sort of like capacitors, but aren’t. They have vertical grooves cut into them at regular intervals around their circumference. The smaller of the two has 4R7 stamped into its plastic case, and the larger one is marked 830. Could these be some kind of high-power resistor, maybe?
Read 14 comments and join the conversationToo Many ARMs!
While I’ve been working on my USB-to-ADB converter with a PIC32, I’ve received a steady barrage of feedback saying I ought to consider an ARM Cortex-M microcontroller instead. There are several reasons I haven’t done that, but one of the biggest reasons is that there are simply too many ARM options for me to keep them all straight! Everyone knows what an AVR is, or a PIC, but my mind is a gray blur when it comes to the various LPC, MSP, and XYZ microcontroller offerings based on ARM cores. While having so many ARM options is good from a price competition standpoint, I have to believe this fracturing of the ARM Cortex-M segment hurts it in its competition with AVRs and PICs. If there were only a single big player making and promoting ARM Cortex-M microcontrollers, I suspect they would have made bigger inroads against Atmel and Microchip.
To help clear the mental fog, I decided to make a list of all the ARM Cortex-M microcontroller families I could name off the top of my head, plus any that have been mentioned here recently by commenters. This isn’t meant to be an exhaustive list, but just the options that are mostly likely to be of interest to hobbyists. I did 10 minutes of research into each one, to find some basic info on distinguishing features and pricing. Maybe this will help you, as it helped me. Pricing is Digikey’s lowest listed price for a device with at least 128K of program Flash memory, in a hobbyist-friendly package (no BGA or QFN), and in single unit quantities.
SAMD (Atmel) – ATSAMD20E17A-AU $3.44, ATSAMD21E17A-AU $3.65. ARM Cortex-M0+. Speeds to 48 MHz. 16K RAM. SAMD20 supports USB Device. SAMD21 supports USB Device and Host. A larger version of the SAMD21 is used in the Arduino Zero.
STM32 (ST Microelectronics) – STM32F070CBT6 $2.66. ARM Cortex-M0. This chip runs at 48 MHz, while others in the STM32 family support speeds to 120 MHz. Supports USB Device. STM32L0 family is Cortex-M0+, STM32F1 and STM32F2 families are Cortex-M3. I did a review of an STM32F1 board a few years ago.
MSP (Texas Instruments) – It turns out this isn’t a 32-bit ARM Cortex-M, but a 16-bit microcontroller based on something called CPUXV2. I’m not sure how it got into the ARM part of my brain.
Launchpad (Texas Instruments) – This isn’t a microcontroller at all, but a series of development boards based on the various TI parts. More brain pollution.
Stellaris (Texas Instruments) – A family of higher-end ARM Cortex-M3 microcontrollers priced at $6.50 and up. This is probably not what I’m looking for, but it’s impressive how well TI’s marketing department has infected my brain with their brands. Does TI actually make a low-end ARM Cortex-M microcontroller? I couldn’t find one.
LPC (NXP) – LPC11E67JBD48E, $4.30. ARM Cortex-M0+. 50 MHz. 20K RAM. Other members of the LPC family are Cortex-M0 and Cortex-M3, with speeds up to 200 MHz.
Kinetis (Freescale) – MKL16Z256VLH4, $4.05. ARM Cortex-M0+. 48 MHz. This device actually has 256K Flash and 32K RAM. Smaller Kinetis devices with 128K Flash are available, but are only offered in QFN packages.
PSoC (Cypress Semiconductor) – CY8C5267AXI-LP051, $6.50. ARM Cortex-M3. PSoC 5 @ 67 MHz. 32K RAM. The PSoC 4 is a Cortex-M0 device and also worth considering, but the models with 128K+ program Flash memory are only offered in QFN packages. The interesting thing about the PSoC 4 and 5 families is that they include configurable logic blocks in addition to the standard CPU core and peripherals. It’s like having a tightly-integrated CPLD built into the microcontroller.
Wikipedia has a small reference table that describes some of the differences between the M0, M0+, and M3 cores.
Suggestion to semiconductor manufacturers: if you want to sell a line of microcontrollers that people will actually remember, give it a pronounceable name, instead of some random acronym. Only TI and Freescale did this.
Software and Tools
OK, maybe that list wasn’t too enlightening, other than to identify the major players. If I’m choosing a microcontroller family to invest time in learning, I’m probably less interested in a $0.60 price difference or 4K of extra RAM, and more interested in the quality of the vendor tools, documentation, peripheral libraries, and examples. I’ll also be interested in the availability of low-cost development boards, and the size of the developer community. How do the options listed above compare in those respects? Who’s got a nifty extra feature, like a built-in bootloader, or some cool hardware peripheral, or a software library that doesn’t suck? Leave a comment and tell me your experiences.
The “elephant in the room” when it comes to ARM Cortex-M development is setting up the toolchain. I described this in my old STM32 review, and it wasn’t a fun process, but that was four years ago. Maybe things have gotten better since then? I know some people are perfectly comfortable installing Eclipse along with a plugin from here, a compiler and linker from there, and a debugger from some other place. Personally I’d rather use an IDE that has as many pieces as possible bundled together, so I can skip the setup and spend more time working on my actual project. Since my earlier review, CooCox seems to have remained popular, and something new called Em:Blocks has also grown in popularity, but most people appear to still be rolling their own toolchain.
Read 15 comments and join the conversationMacintosh System Boot Disks
Did you find an old Mac system in the attic, but it won’t boot up? Was your Craigslist impulse buy delivered without any software? Do you need SCSI utilities to format your hard disk, or a terminal program to connect with the outside world? Macintosh system boot disks, applications disks, and utilities disks are now available in the BMOW store. Get rid of that flashing question mark!
This service will create 800K or 400K Macintosh floppies with essential software for your old Mac Plus, SE, Portable, or similar vintage Mac system. It’s all freely downloadable software from Apple and other sources, and I’m offering this service for computer collectors who can’t create 800K/400K disks on their own. These are are DS/DD double-density floppies, written using Apple’s unique variable-speed recording method. The oldest Macs can’t read common 1.44 MB floppies, and PC and USB floppy drives can’t create 800K/400K disks. The only way to create them is with a 25+ year old floppy drive from an Apple computer.
My primary focus is still on the Floppy Emu solid-state disk emulator, which is also available in the BMOW store. It’s a complete Macintosh and Apple II disk emulator solution that supports an unlimited number of disks downloaded from the web, and hard disk emulation too. But sometimes you just need a floppy or two in order to bootstrap that old system, and Floppy Emu would be overkill. If you’re in that position, head over to the BMOW store and pick up a disk.
Read 2 comments and join the conversationDesigning an Electric Scribbling Machine
I’m working on a design for a “scribbling machine”, similar to the concept shown here from Make Magazine. For the past three years, I’ve led groups of children through a scribbling machine construction project at our school’s annual Discovery Day event. Take a motor with an offset weight on its shaft, attach it to some kind of tripod with colored pens for legs, and add 25 third graders. The offset weight makes the machine vibrate unpredictably, drawing patterns on the paper beneath it as it moves. Every time I’ve done this project, it’s been lots of fun.
Kids, motors, and pens – what could go wrong? Quite a lot, as it turns out. The first year, we used plastic drinking cups as the platform. These were a little too flimsy, and the tapered shape of the cup often caused the offset weight (a piece of glue stick) to whack the cup’s side with each revolution of the motor. For the second year, we used recycled plastic water bottles, with the motor mounted vertically in the neck of the bottle. This solved the clearance problem, but the motors sometimes fell inside the bottles, and the whole platform wasn’t well-balanced to create pleasing scribbles.
Attaching pens, motor, and battery to the platform is more challenging than it seems. The Make design in the photo shows everything held by tape, but we found this didn’t provide a secure enough mount, especially for the motor. We used rubber bands, which had the added advantage of being removable and reusable, to encourage experimentation. But the tension of the rubber bands sometimes deformed or crushed the cups and water bottles. We also learned that many children this age lack the physical dexterity needed to use rubber bands this way. They’d get a few rubber bands on, but then mess up the first ones as they tried to add more, or even get their fingers stuck.
The biggest challenge for the kids has consistently been making a reliable electrical connection between the motor and battery. We tried taping the wires to the end of a battery or using rubber bands to hold the wires, and it works if you’re careful and patient, but those adjectives don’t describe most third graders. Even when it works, this method doesn’t provide any way to turn the scribbling machine on and off, except by disconnecting the wire again. We saw many frustrated kids that couldn’t get their wires to stay put, or whose machines would repeatedly stop running when a wire wiggled loose.
Electric Scribbling Machine 2.0
For this year, I decided to create a completely new platform to address all these issues. It will use a real 2xAA battery holder with built-in on/off switch. No more flaky connections! Kids can twist the wire leads onto the motor terminals, and use tape or hot glue to hold them in place. To solve the stability and fragility problems, I’ve designed a laser-cut platform to hold the pens, batteries, and motor firmly in place. The battery holder goes in the center, the motor is mounted lying on its side with the shaft extending beyond the platform’s edge, and three pens are inserted into any of the many pre-cut holes. By changing which holes are used as pen mounts, and moving the battery and motor, the kids can experiment with differently-balanced machines to see how their behaviors differ.
If the platform is cut from wood or another soft material, I can also include various offset weights with tiny pre-cut holes that press on to the motor shaft. These would replace the glue stick offset weight, and enable easy experimentation with different lengths and shapes of weights, including weights cut into strange shapes.
To attach the parts to the board, I plan to use rubber bands again, but in a simpler way than before. Surrounding each hole in the platform are two U-shaped cut-outs, which create two pegs on opposite sides of the hole. A rubber band stretched between these pegs will hold a motor, battery, or anything else mounted flat against the board. To mount pens vertically, two rubber bands can be used, one each around the pen shaft and a single peg. Or the job can be done with one rubber band that’s twisted twice when it passes around the pen shaft. With the right tension, this should hold the pens vertically and prevent them from slipping out.
Scribbling Economics
This all sounds good, but what will it cost? Discovery Day projects have a budget of $50, which works out to about $2 per child. They’re supposed to be quick and easy projects, with no soldering or other skills needed, that can be completed in about 45 minutes including time for experimentation and play. In past years I’ve spent closer to $3.50 per child, and paid the extra out of my own pocket. For this new design, the battery holder with switch adds another $1.00, and because 1xAA holders with a switch don’t seem to exist, I’ve gone to 2 AA batteries and an additional $0.30 expense.
That’s not too bad, but the potential deal-breaker is the laser-cut platform. Even after optimizing the platform design to make it as cheap as possible, it’s still going to cost between $3 and $7 each to make these platforms, depending on the material used. Even if I aggressively seek the cheapest sources for motors, batteries, and pens, and use the cheapest possible platform material (cardboard), I’m looking at a minimum cost of $5.68 per child, or almost 300% of the budget. In absolute terms that’s not a big deal – it’s only about 25 kids, so it would require an extra $75 or $100 from me out of pocket to make a cool project for the school. My real concern is what that would mean to the other projects. In other words, will I cause problems or bad feelings if I provide a $5 or $10 project when the other leaders provide a $2 one?
I’d assumed plywood would be the cheapest and best material for a project like this, for making both the platform and the offset weights. A small hole cut in a 3 mm sheet of plywood should press-fit onto the motor shaft, which testing will confirm. Unfortunately plywood turned out to be the most expensive option of the ones I considered – $6.74 per platform. The material itself isn’t expensive, but the estimated laser cutting time is higher than the alternatives, and that dominates the total cost. Clear acrylic would be cheaper at $5.24 per platform, but because acrylic doesn’t have any give to it, it can’t be used to make press-fit offset weights. Maybe I could cut the platforms from acrylic and the weights separately from plywood.
The cheapest option is cardboard. Cardboard, you say? Would that really be strong enough? I’m not sure, but I think it might be. Two-ply 6.7mm cardboard and one-ply 1.5mm cardboard would both be about $3.00 per platform. I have some one-ply 1.5mm sample material, and it’s surprisingly rigid. There’s also a one-ply 4.0mm material available for the same price, but my guess is that won’t work as well for the rubber band mounting pegs.
I also considered making the platform as a printed circuit board, from a PCB service like Seeed. The circuit board probably wouldn’t do anything – it would just be a substrate. The cost for a 150mm diameter circular board would be about $5 each, similar to the laser cut acrylic. But I don’t think PCB material could be used to make press-fit offset weights, and PCB manufacturers don’t usually like to cut internal slots like those U-shaped peg cut-outs.
I’ll get a few sample cardboard platforms made, the next time I place an order for other laser-cut parts. If cardboard is strong enough, that’s probably the least expensive solution. The only lower cost alternative would be scrapping the laser-cut platform idea, and using a 2xAA switched battery holder on some random recycled material as the platform. But that wouldn’t be as cool. 🙂
Read 3 comments and join the conversationApple IIc+ is Weird
It’s time for more Apple II love from Floppy Emu! The newest Apple II compatible firmware, apple-II-0.1M, adds a few small but important improvements:
- Fixed Smartport hard disk timing problem when starting from a cold boot (Apple IIgs, IIc, IIc+)
- 3.5 inch disk emulation is now supported on the Apple IIc+
- Floppy Emu Model B can now be connected internally on the IIc+
For hardware Model B: apple-II-0.1M-F8
For hardware Model A: apple-II-0.1M-F6
Floppy Emu is a floppy and hard disk emulator for classic Apple computers. Read more about it at the product page.
The Quirky Apple IIc+
3.5 inch disk support for the Apple IIc+ was something that had eluded me for many months. Thanks to Jeremy Moskowitz for lending me a IIc+ machine, so I could finally do the necessary troubleshooting.
If you’re curious why 3.5 inch disk emulation didn’t previously work on the IIc+, the reason is probably not what you would have guessed. The IIc+ was originally conceived as a 1 MHz machine, like the IIc. The CPU wasn’t fast enough to handle the data transfer speeds of 3.5 inch disks, so a new coprocessor chip called the MIG was added, along with some high-speed cache memory. Later the design was revised, boosting the CPU speed to 4 MHz, and eliminating the need for the unique MIG and cache system. Yet the MIG and cache remained in the final product anyway. I was virtually certain the IIc+ issues with 3.5 inch disk emulation and Floppy Emu were related to the MIG and cache, but it turns out I was wrong.
The problem was actually a limitation of the Floppy Emu design that hadn’t caused trouble previously. In 3.5 inch emulation mode, there are four control lines from the computer. These lines determine which one of 16 state parameters is being read from the drive at any given moment – info like what kind of drive it is and whether it’s at track zero, as well as the instantaneous data bits flying by the drive head on sides 0 and 1 of the disk as it rotates.
There’s no clocking or synchronization on these control lines, so Floppy Emu doesn’t really know when the computer is reading a parameter, versus when it’s transitioning to a different set of control line states. Typically the control lines don’t all change state at precisely the same time, so if the computer was reading parameter 0000 and then wanted to read parameter 1111, the Emu might observe the control lines changing in quick succession in a series like 0000 -> 0100 -> 0110 -> 1110 -> 1111. Normally this doesn’t cause any problems. The Emu briefly emits the info for the phantom states 0100, 0110, and 1110, but the computer isn’t reading these values and ignores them.
The trouble arises with parameters 1000 and 1001, which are the instantaneous data from the disk read head on sides 0 and 1 of the disk respectively. If the Emu observes a read of parameter 1001, it tries to provide data from the sectors on side 1 of the emulated disk. If the side 0 sector data is currently loaded in the Emu’s memory, it dumps it and fetches the side 1 sector data from the SD card. This takes a few milliseconds, and interrupts the flow of data from the emulated disk.
Phantom Reads
As you can imagine, an accidental phantom read of the side 1 parameter during I/O on side 0 would cause major problems, and this is exactly what was happening on the IIc+ in 3.5 inch emulation mode. The computer was repeatedly switching between parameter 1000 (side 0 data) and parameter 1101 (drive ready flag), brushing past 1001 (side 1 data) every time and causing an unnecessary load of side 1 data from the SD card, followed by another load of side 0. The Emu was caught in a perpetual cycle of reloading data from the SD card, and could never get anything else done.
How do you fix a problem like this? If the Emu had enough on-board RAM to load the side 0 and side 1 data at the same time, then there would be no penalty for phantom side switching. This is theoretically possible on the Emu hardware, but only for some disk types, and it would require some big changes to the firmware design. Another approach would be to filter control line states in hardware, and only react to a side 0 or side 1 transition after the control lines had remained at 1000 or 1001 for a while without further changes. This could easily be done in the Emu’s CPLD chip, if there were any space left to implement additional logic. Sadly the CPLD is already near 100% full with the existing disk emulation logic.
The solution I settled on was to poll the CPLD for which side is active, after handling each sector, instead of treating side changes as an interrupt. It’s not the ideal way to handle the issue, but it works. The phantom transition through parameter 1001 still happens on the IIc+, but the Emu ignores it unless it happens to fall right at the moment of polling. This happens very rarely, and when it does happen the computer treats it as a glitchy read, and simply tries the sector again.
Interestingly, I wrote another post titled Phantom Reads here seven years ago, for totally unrelated hardware that shared a similar conceptual problem.
Read 7 comments and join the conversationStandby Current of a USB Car Charger
How much current does a typical USB car charger consume, when nothing is charging? Zero? Microamps? Milliamps? Is it enough to be concerned about draining the car’s battery? There’s no better way to find the answer than direct measurement, so let’s go!
My 2016 Mazda CX-5 has two built-in USB ports, which can theoretically recharge my mobile phone while I’m driving around, but the rate of charge is so slow as to be nearly useless. In an hour of driving, it might raise the phone’s charge level by 15%. To get faster charging, I purchased a USB car charger that fits in the 12V jack in the car’s center console: the ubiquitous jack that was once the cigarette lighter in years gone by, but has now been repurposed as a place to plug in dash cams, DVD players, and other car accessories.
The new USB car charger works fine, and can recharge my phone from zero in about an hour, but it leaves me with a lingering worry. The 12V jack in the 2016 Mazda is not switched by the ignition, but is powered all the time regardless of whether the car is on or off. That means when the car is sitting parked, with the engine off, the USB charger is still drawing current. If I were foolish enough to leave some power-hungry appliance connected, it could quickly drain the car’s battery. But even with nothing connected, the USB charger will still draw some standby current. To measure it, I put together a quick test involving a 12V wall supply, the USB charger, a multimeter, and lots of alligator clips.
The answer: the USB charger’s standby current is 14.2 mA. I would have guessed microamps, so I was way off. It doesn’t help that the charger has an LED that’s continuously illuminated whenever it’s powered.
Is a constant 14.2 mA draw enough to worry about discharging the car’s battery? Probably not. From a few quick searches, I learned that a typical car battery has a capacity of around 40 ampere hours. At 14.2 mA, it would take 2817 hours or 117 days to completely discharge the car’s battery. Assuming I drive the car every day, then, it’s not a concern. Even parking the car for a week or two should be fine. But if I ever need to leave the car in storage for an extended period of time, that 14.2 mA could add up. Of course the car itself has its own standby current draw for the anti-theft system and keyless entry, so the USB charger may not even be the largest concern. For typical driving, at least, it appears the USB charger’s standby current draw won’t be a problem.
Read 11 comments and join the conversation