Saturday, May 23, 2015

Cycliq Fly6 review

Just posted on YouTube, a review of the Cycliq rear video camera + taillight.

Today's morning irritation

Brought to you by Antec.

My PC has occasionally been powering down a few seconds after powering up over the last few weeks. This morning it was consistent so the thing wouldn't start up at all.

I dropped in a new power supply (I always keep a spare power supply around).  Didn't help. Unplug a few things, then a few things more, then everything.  Didn't help.  I'm thinking "Crap.  I have a dead mainboard."

But in the process of "unplug everything" I unplugged the power switch and then went "duh, need the power switch to turn it on, genius" but then I thought about the symptoms and thought "Hey, it's acting exactly like the power switch is being held on.

I pulled off the power switch connector, then when I plugged it back in the mainboard started up. Tada, the power switch was shorted.

Good, I won't be scrounging up a mainboard out of the junk box today to get another machine up and running. I really had other stuff to do today.

Turns out that the Antec case design puts the leads to the power switch right up against a bare cut piece of metal. They rely on some heat shrink tubing to insulate it. This is guaranteed to fail eventually. I confirmed with my meter that a slight bit of pressure on the switch causes one of the wires to short to the case.

Luckily the sheet metal on modern cases is paper thin so it was easy to bend the metal away.  This leaves the switch a little wobbly as it uses that little flap to stabilize the switch holder. But it's stable enough for now. If it becomes a problem I'll design and 3D print a new holder with a strut out to the side to take its support from farther out in the case.

Sunday, May 17, 2015

Arduino Blocks: Serial communications and an SD card reader

This is just a 2 minute quick video to get back in the game, it's been a while since I posted one of these.

I have a project in mind that will need a lot of storage. SD cards are a great way to do that. Here's a video showing that all you need to use an SD card is a card slot that costs about a buck and some wires.

The SD card design was intended to reduce costs by designing the card to speak the "language" that microcontrollers were already speaking anyway; serial communications, in this case SPI.  There is also a high speed mode, but it is much more complex and you need a license to use it, so we won't speak about it any more

Serial communications just means that even though we have a bunch of bits that we want to write or read to a device, we send those bits over one at a time. Given the speed that electronics goes at these days, that's not as slow as you'd think, and it allows you to send basically unlimited amounts of data over just a few wires.

Serial communications is VITALLY important to this sort of design. Pretty much all non-trivial devices speak serial. In fact we've already used serial communications, in the blocks with the 8 LED/8 switch panel - the way it controlled all those LEDs and switches with just a few wires was via a serial interface.

There are many serial communications types (or "protocols").  The two most important for microcontrollers are SPI and I2C. Both are heavily used in the industry and if you do much messing around, you'll eventually have to use both. However, it will be very unusual if you have to actually write the code that directly speaks to the device, though it doesn't hurt to know what's going on when you call the standard library functions.

At the bottom of this article I've embedded a video explaining some of the protocols a bit. Ben Heck does a great job explaining the basics. You should DEFINITELY watch this video; you're going to need to know this stuff.

SPI requires 4 lines. Chip select, which tells the chip "I'm talking to YOU", a clock line (every time it pulses, the controller is telling the device "the next bit is ready for you" or "Give me the next bit" then two lines, called MOSI (Master Out Slave In) which sends data TO the device, and MISO (Master In Slave Out) which pulls data from the device to the controller

The Arduino environment already comes with a library that can speak to SD cards and read standard FAT and FAT32 filesystems (the standard for SD cards). I only ran the first sketch here to make sure things work. There are several others there, these should give you most everything you need to get going.