Andrew Que Sites list Photos
Projects Contact
Main
   Someone at work made cookies and I ate too many.  So when I got home, a bike ride was in order.  It has cooled off significantly since yesterday but the temperature is still ride-able around around 50ºF (10ºC).  There was a fairly steady wind from the northwest at 7 MPH.  It wasn't awful, but it made for a chilly ride.  I did my Airport-Ashton run.  Over the summer I had been making this run at 45 minutes.  Today it took 1 hour, 1.5 minutes.  Still, I burned off 744 Calories and got some lovely sun shot pictures.
   Unseasonably warm weather today with a high of 73°F (22.8°C).  I rode into work and the temperature was already over 50 when I set out just before 6:00 am.  It was so warm I removed my sweatshirt about 2 miles into the ride.  The ride home was windy but so warm I hardly wanted my long sleeve breathable shirt.  I visited Pokie in downtown and we got dinner at an Italian place on State Street.  When I continued on home it was still very comfortable despite the sun having set.  Now I miss biking in warm weather because I remember how much nicer it is to do so!
   I do a lot of ordering from eBay from sellers in China.  Generally it works in my favor and I can get very cheap electronic parts for all my projects.  On occasion it doesn't work out.  I order 4 power monitoring boards.  They are designed to measure both current and voltage and communicate that information via I2C.  I found a distributor with a very good price and ordered them.  When they arrived, 3 were dead and only 1 was functional.  Two got hot just from having power, and one did nothing.  The seller packaged them in plain plastic bags.  The climate in Hong Kong is humid sub-tropic, and they probably don't have as much of an issue with static electricity as we do in dry winter Wisconsin.  I suspect the chips were killed by ESD during shipping.  Now I'm going to need replacements, and find some shipped in ESD bags.
Liz

Liz

   Skating again tonight with Liz.  The floor was quite open and everything seemed setup for a good night of hard skating, but I felt drained.  I skated the full 3 hours, and only because the D.J. left the music going for an extra song did I make my goal of 2,500 Calories for the night.  But just barely.  My average heart rate was 163 BPM (89% of maximum) which is a good rate, but my top end was only 186 BPM (101.6%) and my Calorie burn rate was 799 Calories/hour.  I haven't had a burn rate that low since December. 
   This week was the first week of returning to a set of push-ups each hour at work.  I started at 50/set and my arms hate me.  This is down significantly from August when I was able to do 100 or more each set, but a good starting point.  Perhaps the fatigue of the push-ups through out the week, maybe mixed with cycling both Thursday and yesterday were holding me back tonight.  It is possible.  I know over the summer if I had a long ride on Friday my Saturday skating was effected.  I will have to continue to monitor this.  Just because I don't feel fatigued may not mean my body isn't tired and recovering.  So this could be an interesting observation about myself.
 
   Biked into work today and nearing the end of my book on Joseph Stalin.  It was a long book, but it turns out it is just one in a series.  This one covers his life from birth to 1928 and did a fantastic job of outlining the politics of late 19th century Russia and eastern Europe.  I learned a great deal about how the Bolsheviks in all their unlikelihood ended up in power, how Stalin both obtained, and how his experiences and devotion to Leninism shaped his disastrous policies.  Very dry, but fascinating stuff.
   Pictured are sleeping trucks at a truck stop.

March 02, 2016

8-bit Balanced G-Code

   The other day my Arduino Mega knock-off arrived.  I have a bunch of Arduino Nanos, but a project I'm looking into needs a lot more I/O.  The Mega sports 56 I/O pins and will do nicely.  Today I hooked up a relay board to give the setup a test.  The Mega can drive the relays directly but I'm concerned they may draw too more current than the chip wants to provide.  So I think I am going to play it safe and use an external supply to drive the relays.  I ran some code that switched the relays just to hear them react.  Initially I ran a binary count.  I didn't feel like spiking the current and decided to run a Gray Code to the relay output.  Gray code keeps makes sure only one bit (or relay) changes at a time.  That's nice but still causes the first relay to clatter the most.  I wanted something that would make all the relays turn on and off the same number of times throughout the count.  I found balanced Gray code and that did the trick.  This setup isn't useful to me, but it was kind of a cool experiment.  Here is the code:
// 8-bit balanced gray code table.
// Copied from: http://gary-williams.livejournal.com/16275.html
uint8_t const GRAY_CODE[ 0x100 ] =
{
  0x000x010x030x020x060x0E0x0A0x0B0x090x0D0x0F0x070x050x040x0C0x08,
  0x180x1C0x140x150x170x1F0x3F0x370x350x340x3C0x380x280x2C0x240x25,
  0x270x2F0x2D0x290x390x3D0x1D0x190x1B0x3B0x2B0x2A0x3A0x1A0x1E0x16,
  0x360x3E0x2E0x260x220x320x120x130x330x230x210x310x110x100x300x20,
  0x600x700x500x510x710x610x630x730x530x520x720x620x660x6E0x7E0x76,
  0x560x5E0x5A0x7A0x6A0x6B0xEB0xEA0xFA0xDA0xDE0xD60xF60xFE0xEE0xE6,
  0xE20xF20xD20xD30xF30xE30xE10xF10xD10xD00xF00xE00xA00xB00x900x91,
  0xB10xA10xA30xB30x930x920xB20xA20xA60xAE0xBE0xB60x960x9E0x9A0xBA,
  0xAA0xAB0xBB0x9B0x990x9D0xDD0xD90xDB0xFB0x7B0x5B0x590x5D0x7D0x79,
  0xF90xFD0xBD0xB90xA90xE90x690x6D0x6F0x670x650x640xE40xE50xE70xEF,
  0xED0xAD0xAF0xA70xA50xA40xAC0xEC0x6C0x680xE80xA80xB80xF80x780x7C,
  0xFC0xBC0xB40xB50xB70xF70xF50xF40x740x750x770x7F0xFF0xBF0x9F0xDF,
  0x5F0x570x550x540xD40xD50xD70x970x950x940x9C0xDC0x5C0x580xD80x98,
  0x880xC80x480x4C0xCC0x8C0x840xC40x440x450xC50x850x870xC70x470x4F,
  0xCF0x8F0x8D0xCD0x4D0x490xC90x890x8B0xCB0x4B0x4A0xCA0x8A0x8E0xCE,
  0x4E0x460xC60x860x820xC20x420x430xC30x830x810xC10x410x400xC00x80
};

// LED pin.
enum { LED_PIN = 13 };

void setup()
{
  pinMode( LED_PIN, OUTPUT );

  // Set all I/O on port F as outputs.
  DDRF = 0xFF;
}

static uint8_t count = 0;

void loop()
{
  // Translate 'count' to Gray Code and output.
  PORTF = GRAY_CODE[ count ];

  // Toggle LED pin.
  digitalWrite( LED_PIN, ( count & 0x01 ) );

  // Delay for a bit.
  delay( 250 );

  // Next...
  count += 1;
}
   When I moved into Elmwood Park two and a half years ago I got my first actual credit card though my bank.  They do a credit check and I learned I had a credit score of 0.  I didn't even know that was possible, but it was because my record was empty.  My goal with having a credit card was to establish a good credit rating, and clearly I had a ways to go.  So my first credit card was a secured card backed by money locked in a savings account.  Around six months ago I unsecured the card, and applied for a second credit card on the advice of my banker.  I don't know what my score is right now, but it must have gone up as I now receive at least two credit card mailing a week.  I always keep these so I can burn them, but the quantity is getting absurd.  Who, after a couple years of receiving mailings suddenly says "you know what, I now need this?!"  But then I have never understood marketing.  I have signed up for the don't-mail-me-credit-offers list and we'll see if that helps.  In the meantime I have a fire to start.