Recently in Electronics Category

Flipping bits (and not burgers)

| No Comments | No TrackBacks
I am writing code to talk to a Seiko S-35390A Real Time Clock (RTC) chip for the new Battery Management system I am designing for REVOLT Custom Electric Vehicles.  The chip communicates with my microcontroller via I2C, a reasonably well defined standard.  I2C,conveniently defines the bit order for data transmitted over the bus.  The RTC chip, for some reason, requires all of it's data to be sent as BCD encoded data with the bits reversed from the bus standard, (LSB becomes MSB.)  Reversing bits should be a textbook problem, but I found only a few clean ways to do it. There is probably an simpler way using 16bit shifts but here is a solution using a lookup table.

//Seiko RTC chip uses an annoying packing system where the LSB
// of the BCD represented data is in the MSB of the value
// that has to be written to the register.  This function
// does the bitwise flip of each nybble using a lookup, and
// swaps the two nybbles. 
unsigned char RTC_ConvertRBCD( unsigned char value ) {
    const unsigned char tobcd[] = { 0x0, 0x8, 0x4, 0xC,
      0x2, 0xA, 0x6, 0xE, 0x1, 0x9, 0x5, 0xD, 0x3, 0xB,
      0x7, 0xF };

    return (tobcd[value & 0x0F] << 4 ) + tobcd[value >> 4];
}

//Input is a 8bit number, returns the BCD encoded, bit reversed
// value needed by the Seiko RTC chip registers
unsigned char RTC_ToRTCBCD( unsigned char value ) {
    return RTC_ConvertRBCD( ( ( value / 10) << 4) + ( value % 10 ) );
    //return  RTC_ConvertRBCD( ( ( value / 10) << 4) + ( value & 0x0F) );
}

//Input is a bit reversed packed BCD register value from
// the Seiko RTC chip, return is a normal 8bit value
unsigned char RTC_FromRTCBCD( unsigned char bcdvalue ) {
    unsigned char unpacked = RTC_ConvertRBCD( bcdvalue );
    return ( ( unpacked >> 4 ) * 10) + ( unpacked & 0x0F );
}

I be, you be, Yubikey

| No Comments | No TrackBacks
Cool, and simple.  The Yubikey is a one-time password generator in a USB key.  Plug in in and it emulates a USB keyboard.  Touch the button on it and it will type out a one-time use password.  Basically the same system as "rolling code" garage door openers.

The hardware should be pretty cheap having no battery like the RSA SecurID tokens, just a microcontroller.   It claims to be somewhat resistant to phishing, though I cannot see how that works. 

The YubiKey
It works seamlessly with any hardware and operating system combination supporting USB keyboards such as Windows, MacOS, Linux and others. The Key generates and sends unique time-variant authentication codes by emulating keystrokes through the standard keyboard interface. The computer to which the Key is attached receives this authentication code character by character just as if it were being typed in from the keyboard - yet it's all performed automatically. This process allows the Key to be used with any application or Web-based service without any need for special client computer interaction or drivers.

The YubiKey differs from traditional authentication tokens based on time-variant codes in that it needs no battery and therefore does not rely on an absolute time generated by an accurate time source. No battery means unlimited shelf life, no synchronization and customer support issues, and enables significant cost reduction.

Link

Packaging electronics projects

| No Comments | No TrackBacks
I am a partner in an Electric Vehicle Conversion and Parts company, REVOLT Custom Electric Vehicles.  So far that has involved designing custom electronics to interface standard components to the vehicle systems. 

Our first project was to reverse engineer all of the CAN communications in a Mazda 3.  Certain communications from the engine computer (PCM) are required to make the dashboard and power steering system operate correctly.  On the Mazda (and most Ford products I've seen) the PCM is part of the engine wiring harness which connects to the car in only one place.  This probably makes it very easy to offer different engines in the same vehicle.   In our case it made it easy to connect our electric drive system to that one connect.  I designed a small PCM around the Microchip PIC 18F2580 processor with integral CAN controller.  The PCM listened for certain messages on the bus (like speed, Air conditioning on, and anti-theft), and gathered data from the electric drive system.  It then sent messages that updated the odometer, speedometer, tachometer, radiator fan and many other systems.  The net effect for the driver is that the vehicle behaves exactly as it did from the factory.  For us very little modification of the dash area was required, it is largely a "plug in and go" conversion.

Laying out circuit boards, and designing software is fairly straightforward.. I've been doing hobbyist electronics work since I was about 12.  I like to think I'm not half bad despite my lack of a Electrical Engineering degree (I graduated with a Computer Science degree instead).  Oddly the biggest problem I face is connectors.

In the hobbyist EV world elevator screw terminals, or faston connectors are the norm.  They are both inexpensive, but neither is really vibration resistant enough to trust in an automotive environment.   Both also involve having holes in the enclosure where water could potentially enter.  I've been looking instead for a connector that is PC Board mount, but can penetrate the enclosure shell in a water resistant fashion.  Ideally the mating (wire side) connector should be easy to assemble, since I expect my customers will have to do that part.

As it turns out, there are only a few options.. most water resistant connectors are wire to wire, not wire to board.  The best I've seen so far are the Molex MX-150 line.  Its rapidly turning out to be a "designing the circuit is easy, designing a complete package with connectors and enclosure is hard".  No wonder most EV parts suppliers don't sell electronics in enclosures.

About this Archive

This page is an archive of recent entries in the Electronics category.

Job Search is the next category.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.24-en