<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>Mike Tsao geeks out.</title><generator>Tumblr (3.0; @sowbug)</generator><link>http://www.sowbug.com/</link><item><title>Hypna Go Go Goes 3D</title><description>&lt;p&gt;In my continuing quest for lucidity, I&amp;#8217;ve had trouble figuring out exactly when my personal REM phases occur at night. Preliminary measurements and intuition suggest that they&amp;#8217;re happening quite early &amp;#8212; as early as two hours after I sleep. So it&amp;#8217;s not surprising that the Hypna Go Go, using a naive time-based scheduling algorithm, doesn&amp;#8217;t seem to be doing a good job of guessing the answer, either.&lt;/p&gt;
&lt;p&gt;As an experiment, I&amp;#8217;ve ordered an &lt;a href="http://www.sparkfun.com/products/10955"&gt;MMA8452Q accelerometer breakout board&lt;/a&gt; from SparkFun, and I&amp;#8217;m going to build a new version of the circuit that starts the light programs when I&amp;#8217;m not moving, which should be correlated with the &lt;a href="http://en.wikipedia.org/wiki/Hypotonia"&gt;hypotonia&lt;/a&gt; of REM sleep paralysis. The advantage of this approach versus, say, using an infrared receiver to measure eye movement, is that the board remains small and simple, without too many scary parts poking out near my eyes, and easy for me to sew into a relatively comfortable sleep mask.&lt;/p&gt;</description><link>http://www.sowbug.com/post/24066434599</link><guid>http://www.sowbug.com/post/24066434599</guid><pubDate>Wed, 30 May 2012 08:59:12 -0700</pubDate><category>Hypna Go Go</category><category>dreams</category></item><item><title>New Project: Like A G35</title><description>&lt;p&gt;Last year I took some good work by &lt;a href="http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/"&gt;Robert Sun Quattlebaum&lt;/a&gt; and others and made an &lt;a href="https://github.com/sowbug/G35Arduino"&gt;Arduino library&lt;/a&gt; that controls GE G35 Color Effects Christmas lights. For the 2011 season I whipped up a quick perfboard using a &lt;a href="http://pjrc.com/teensy/"&gt;Teensy&lt;/a&gt;, and since then I&amp;#8217;ve wanted to build a more permanent board that I might leave up year-round; after all, plenty of evenings call for fancy lighting. Why let Christmas have all the fun?&lt;/p&gt;
&lt;p&gt;Thus, a few days ago I started my latest project: &lt;a href="https://github.com/sowbug/like-a-g35"&gt;Like A G35&lt;/a&gt;. It isn&amp;#8217;t much at the moment, but if I start prototyping now (in May), it ought to be ready to go by the time I want to deploy it (Halloween at the latest).&lt;/p&gt;
&lt;p&gt;The circuit will be my first based on the ATmega32U4. I&amp;#8217;ve worked on that chip quite a bit via &lt;a href="http://www.ladyada.net/products/atmega32u4breakout/"&gt;Adafruit&amp;#8217;s breakout board&lt;/a&gt;, but I&amp;#8217;ve never gotten around to a build with it. It&amp;#8217;ll be fairly simple:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Micro-USB socket for programming and power.&lt;/li&gt;
&lt;li&gt;ISP6 header for initial programming (remember, the &amp;#8216;32U4 isn&amp;#8217;t available in DIP).&lt;/li&gt;
&lt;li&gt;Three 3-position terminal blocks to support up to three strands of lights.&lt;/li&gt;
&lt;li&gt;A second two-position terminal block for alternate power.&lt;/li&gt;
&lt;li&gt;A beefy voltage regulator (at least 6 amps if I want to support three strands).&lt;/li&gt;
&lt;li&gt;An infrared receiver to change programs.&lt;/li&gt;
&lt;li&gt;A PCF8523 real-time clock with battery backup to display different programs depending on time of year.&lt;/li&gt;
&lt;li&gt;Pinouts for whichever GPIO pins are left on the chip.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;In all likelihood I&amp;#8217;ll solder only the USB socket, the &amp;#8216;32U4, and two of the terminal blocks, because I have only two strands on my house, I prefer to power directly through USB, and I won&amp;#8217;t get around to any RTC or remote functionality. But in case other people want to build the board and use it for other purposes, it&amp;#8217;ll be nice to have those other features optionally available.&lt;/p&gt;</description><link>http://www.sowbug.com/post/23737105747</link><guid>http://www.sowbug.com/post/23737105747</guid><pubDate>Fri, 25 May 2012 08:54:00 -0700</pubDate><category>G35</category></item><item><title>RPio is assembled and (so far) working</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m3xz7v92kI1qjj3vh.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;I assembled one of the SeeedStudio boards and began testing. The power sections appear to work correctly, the project LEDs all behave as expected, and the TXB0108 I/Os are not surprising me (that&amp;#8217;s a qualified statement because I haven&amp;#8217;t yet run them all the way through their paces).&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m3xzctLGjR1qjj3vh.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;I haven&amp;#8217;t yet tried the two I2C circuits. Once I&amp;#8217;ve completed this testing, I&amp;#8217;ll have done pretty much everything I can before getting access to a real board.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m3xzeoxQul1qjj3vh.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;As you can see from this preassembly photo, I mistakenly ordered 0603 resistors rather than the 0805 size that the layout intended. But having assembled the board, I can say without hesitation that &lt;em&gt;soldering 0603 parts onto 0805 pads is sheer delight&lt;/em&gt;. It&amp;#8217;s like moving into a loft with no furniture yet; there&amp;#8217;s just so much room!&lt;/p&gt;</description><link>http://www.sowbug.com/post/22975148735</link><guid>http://www.sowbug.com/post/22975148735</guid><pubDate>Sun, 13 May 2012 09:03:07 -0700</pubDate><category>rpio</category><category>raspberry-pi</category></item><item><title>Hypna Go Go Algorithm Adjusted</title><description>&lt;p&gt;The &lt;a href="/hypnagogo"&gt;Hypna Go Go&lt;/a&gt; recently woke me up three times in one night. I&amp;#8217;ve &lt;a href="https://github.com/sowbug/hypnagogo/commit/19dad15bac9c3044ce51e20b6702617b921ee203#firmware/main.c"&gt;adjusted the lighting algorithm&lt;/a&gt; to fade in gently, and hope this will help.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update: Progress. I had a &lt;a href="http://en.wikipedia.org/wiki/False_awakening"&gt;false awakening&lt;/a&gt; after this change, in which I took off my sleep mask and tried to shut off the HGG, but discovered the battery was getting weak. Then in real life my kids woke me up. I consider this to be progress because it was my first reaction to the lights where I didn&amp;#8217;t wake up. Unfortunately, rather than realizing I was dreaming, I did what I usually do when the lights wake me up: I take off the mask and shut off the device.&lt;/strong&gt;&lt;/p&gt;</description><link>http://www.sowbug.com/post/22844356002</link><guid>http://www.sowbug.com/post/22844356002</guid><pubDate>Fri, 11 May 2012 08:55:00 -0700</pubDate><category>Hypna Go Go</category><category>dreams</category></item><item><title>OK Wake is done!</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m3u5nbxPD11qjj3vh.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;I ran through a full sequence Tuesday night and was happy with what I saw. So I&amp;#8217;ve tagged the project &lt;a href="https://github.com/sowbug/ok-wake/zipball/FIRMWARE_WORKING_1_0_0"&gt;FIRMWARE_WORKING_1_0_0&lt;/a&gt;, and after a morning or two to confirm that the actual devices are working, I&amp;#8217;ll deliver one to my friend.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s fun to finish projects. The &lt;a href="/hypnagogo"&gt;Hypna Go Go&lt;/a&gt; is a practical device that I use almost daily, and now OK Wake has the potential to help a friend and his family manage their morning routine. I feel a sense of accomplishment.&lt;/p&gt;
&lt;p&gt;Next tasks: build an &lt;a href="/rpio"&gt;RPio&lt;/a&gt; (the boards arrived over the weekend, though still no Raspberry Pi on the horizon). And do one more hardware revision of the &lt;a href="/isp"&gt;AVR Programmer&lt;/a&gt;. I also have a couple more quick projects in mind.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22840311505</link><guid>http://www.sowbug.com/post/22840311505</guid><pubDate>Fri, 11 May 2012 07:00:13 -0700</pubDate><category>OK Wake</category><category>Hypna Go Go</category><category>avr-programmer</category><category>rpio</category></item><item><title>RPio prototypes are here</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m3t9q8xHK21qjj3vh.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;Now all I need is a Raspberry Pi!&lt;/p&gt;</description><link>http://www.sowbug.com/post/22782569904</link><guid>http://www.sowbug.com/post/22782569904</guid><pubDate>Thu, 10 May 2012 08:59:54 -0700</pubDate><category>rpio</category></item><item><title>OK Wake firmware, status report #2</title><description>&lt;p&gt;Things are looking better.&lt;/p&gt;
&lt;p&gt;I wrote a unit test suite that is buildable with regular GCC, so I was able to get the arithmetic routines written quickly without coaxing tiny LEDs into telling me the microcontroller&amp;#8217;s entire internal state. This worked well. I didn&amp;#8217;t have to stub or mock out the hardware, but I could see doing that for a more complex project.&lt;/p&gt;
&lt;p&gt;I briefly dabbled in pure shift-based arithmetic (multiply by 205, shift right 11 times!) when I ran out of program space and took a hard look at the assembly with avr-objdump -S. This didn&amp;#8217;t work out; doing mod 10 to convert from decimal to BCD was eye-crossing and approaching the size of the avr-libc mul/div libraries. Instead I took a different approach.&lt;/p&gt;
&lt;p&gt;I hated the AVR310 reference I2C code for its size and seemingly needless complexity, so I replaced it with Peter Fleury&amp;#8217;s awesomely tiny &lt;a href="http://homepage.hispeed.ch/peterfleury/group__pfleury__ic2master.html"&gt;I2C Master library&lt;/a&gt;. I couldn&amp;#8217;t believe that it worked perfectly on the first try. Since it uses plain GPIOs and doesn&amp;#8217;t mess with the USI, I could even rework the circuit in the future to move the button/INT functionality to the &amp;#8216;25&amp;#8217;s INT0 pin, getting more precise pin-change interrupt events in the bargain.&lt;/p&gt;
&lt;p&gt;This got me well under 0x700 bytes, so I could once again easily afford to use *, /, and % (I actually skipped %, preferring to multiply back the division result and subtract from the original value).&lt;/p&gt;
&lt;p&gt;Code&amp;#8217;s looking good and starting to feed solid.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22719036139</link><guid>http://www.sowbug.com/post/22719036139</guid><pubDate>Wed, 09 May 2012 09:01:26 -0700</pubDate><category>OK Wake</category></item><item><title>OK Wake firmware, status report</title><description>&lt;p&gt;I have the AVR and the PCF8523 communicating with each other, and the AVR is mostly able to manipulate its own EEPROM. Things are at least a couple bugfixes away from working end-to-end, though.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Things I Learned Recently&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;The RTC should be reset when the AVR starts up. It&amp;#8217;s far too easy to leave it with sticky state that causes known-good code to misbehave. Fortunately, resetting leaves the time and alarms intact, so it&amp;#8217;s nondestructive to do it regularly.&lt;/li&gt;
&lt;li&gt;The ATtiny25 has frustrating support for I2C, a.k.a. TWI or two-wire mode. Yes, it has a USART that can do what I&amp;#8217;ll call hardware-assisted bitbanging of I2C, but the code to actually do that bitbanging uses up lots of program space. The combination of 8-pin AVR, I2C, and small program space is challenging. I think I can do it, but it might be smarter to switch to an ATtiny85 during development so I can add more diagnostics while debugging.&lt;/li&gt;
&lt;li&gt;I was spending a lot of time trying to distinguish different reasons why my single interrupt was firing (button-press, /INT low for second interrupt or alarm) without communicating with the &amp;#8216;8523. The reason for the no-communication part was that the &amp;#8216;8523 was unavailable within the interrupt (interrupts disabled = no I2C). This was a losing proposition. It was much easier to have the interrupt wake me up, exit the interrupt without doing any work, then ask the &amp;#8216;8523 via SF/AF whether it wanted me awake. If yes, deal with that. If no, then it must have been the button. This approach is much more solid, and it&amp;#8217;s what the &amp;#8216;8523 designers intended.&lt;/li&gt;
&lt;li&gt;Doing development with a coin-cell-powered circuit means that your code might start acting weird if the coin cell approaches 1.8V. Better to power via a reliable supply during development.&lt;/li&gt;
&lt;li&gt;Power pins and test points would have been a godsend on this ridiculously small board. I should have added a header for V+, GND, /INT, SDA, and SCL. Nice big 0.1&amp;#8221;-spaced pins to attach logic probes.&lt;/li&gt;
&lt;li&gt;Binary-coded decimal is a &lt;em&gt;&lt;strong&gt;pain&lt;/strong&gt;&lt;/em&gt; to work with. This is the &amp;#8216;8523&amp;#8217;s native number format. I am currently staying in packed BCD for all operations, which neutralizes the annoyance, except for doing time math, where I have to convert back to regular decimal. I need to think harder about whether there&amp;#8217;s a clever way to multiply/divide by 60 in native packed BCD.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://www.sowbug.com/post/22655411169</link><guid>http://www.sowbug.com/post/22655411169</guid><pubDate>Tue, 08 May 2012 08:53:56 -0700</pubDate><category>OK Wake</category><category>AVR</category></item><item><title>avr-gcc and static initializers</title><description>&lt;p&gt;In the &lt;a href="http://www.nongnu.org/avr-libc/user-manual/FAQ.html"&gt;avr-gcc FAQ&lt;/a&gt;, the question &amp;#8220;Shouldn&amp;#8217;t I initialize all my variables?&amp;#8221; gives a hint why your nonzero static initializers aren&amp;#8217;t working:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[G]lobal and static variables that have an initializer go into the .data section of the file.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had been seeing static variables without a declared assignment correctly initialized to zero, but any nonzero initialization didn&amp;#8217;t seem to be doing anything. But reading the FAQ led me to examine my makefile, where I found this interesting section:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;%.hex : main.obj&lt;br/&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;$(OBJ2HEX) -j .text -O ihex $&amp;lt; $@&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;Aha! So avr-gcc was likely putting the initialized variables into .data, but I was omitting that section when generating the Intel hexfile. Adding another -j section for .data fixed it.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22590821864</link><guid>http://www.sowbug.com/post/22590821864</guid><pubDate>Mon, 07 May 2012 09:01:51 -0700</pubDate><category>AVR</category></item><item><title>How I memorized π to more than 60 places</title><description>&lt;p&gt;In high school I memorized &lt;a href="http://en.wikipedia.org/wiki/Pi"&gt;pi&lt;/a&gt; to 18 places. It was easy; when you&amp;#8217;re 15 years old you can achieve any mental feat imaginable. Knowing the number to excessive precision was useful when I was programming games or art projects, and when doing geometry homework, I would take a 10-second doodle break by writing the number out in the margin. Like the home phone number my mom made us memorize when we were kids (408-722-2997), the number&amp;#8217;s now burned forever in my brain. 3.14159265358979323.&lt;/p&gt;
&lt;p&gt;I never tried memorizing any further, because (a) it seemed pointless, and (b) I figured it was one of those youthful talents lost to the sands of time. But over the past couple months, I have memorized pi to over 60 places. It wasn&amp;#8217;t hard to do, and here&amp;#8217;s how I did it.&lt;/p&gt;
&lt;p&gt;First, of course, I started with the first 18 digits and built on that. Over the years, while reciting the sequence to myself, I&amp;#8217;ve developed a bit of a cadence and rhythm in the delivery. It&amp;#8217;s not quite a song, but it becomes effortless to recall it the same way I can remember song lyrics. So I tried to continue to do that.&lt;/p&gt;
&lt;p&gt;Second, I picked small chunks of digits. I know nobody remembers phone numbers anymore, but I&amp;#8217;ve heard that the inventors of phone numbers put the dash in between the groups of numbers to turn it from the challenge of remembering seven (or ten) individual numbers into a simpler task of memorizing two (or three) groups of numbers. For me, groups of six seem to work well, because I can recite the six as di-di-di (pause) di-di-di (pause), and it stays in a 4/4 time signature (that&amp;#8217;s a musical term; remember that I find it easier if they&amp;#8217;re recited according to a rhythm).&lt;/p&gt;
&lt;p&gt;Third, I practice at least a couple times a week. I&amp;#8217;ll recite it to myself when I&amp;#8217;m waiting in line for lunch or stuck in traffic. I can&amp;#8217;t yet say that this will lead to permanent recall (in the way that I&amp;#8217;m confident I&amp;#8217;d remember the first 18 digits even if I didn&amp;#8217;t think about them for five years), but I haven&amp;#8217;t noticed any dropoff yet.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s pretty much it. I have attached some mnemonics to specific sequences, which I&amp;#8217;ll describe below, but those feel more like excess mental baggage that my brain has stored away, rather than a recall aid. Or maybe not; I really can&amp;#8217;t tell.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s the story of the individual digits:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;3.14159&lt;/strong&gt;: everyone knows this.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;265358&lt;/strong&gt;: the &amp;#8220;65,&amp;#8221; &amp;#8220;35&amp;#8221; part is starting to establish a rhythm.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;979323&lt;/strong&gt;: this is two groups of 3-digit palindromes, and the 323 is a Mazda car model, which reminds me of the Mazda 626, which is the car I was in when my dad decided the red traffic light must be broken and proceeded to almost kill me when we got T-boned in the intersection by a car that had the green.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;846264&lt;/strong&gt;: again a palindrome inside this sequence, and 264 reminds me of the h.264 codec.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;338327&lt;/strong&gt;: so many threes. For the second half, three times nine is 27, and because my brain has accumulated the two threes from the first half, it&amp;#8217;s already primed to spit out 27 as the product of 3 x 3 x 3.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;950288&lt;/strong&gt;: makes no sense to me (other than that 288 = 2 x 12 x 12, which is cool), but it&amp;#8217;s memorable mostly because it&amp;#8217;s a nonsense sequence.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;419716&lt;/strong&gt;: 419 is the number associated with those I AM HEIR TO THRONE AND NEED YOUR HELP spam mails (it&amp;#8217;s some reference to a penal code or something like that), and the 716 forms almost the same shape if you&amp;#8217;re dialing it on a phone keypad.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;939937&lt;/strong&gt;: this is weird because it has so many nines in it, and when dialed on a keypad it reminds me of a person on a trampoline jumping back and forth and then accidentally flying off it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;510582&lt;/strong&gt;: 510 is an area code in the San Francisco Bay Area, and the 582 starts with the same digit.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;097494&lt;/strong&gt;: makes no sense at all. I need to explicitly remember that after the 510 sequence, the next sequence starts with a zero. The 494 is easier to remember than the 097 because it&amp;#8217;s a palindrome.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;459230&lt;/strong&gt;: this is the most recent sequence I&amp;#8217;ve memorized, and I don&amp;#8217;t have it down yet. 459 is dangerously close to the palindromic displacement of the old Chevy 454 engine (dangerously because at the moment I can&amp;#8217;t easily remember the 9), and 230 is a protective provision in the otherwise awful 1996 Communications Decency Act U.S. legislation.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So that&amp;#8217;s actually getting close to 70 places, and as you can see there&amp;#8217;s quite a bit of mnemonic baggage that my brain has conjured up on its own. I will probably keep memorizing more digits because it beats watching TV as far as pointless activities go. However, the number of digits memorized at this point is getting into weirdland, so I might take a break from new digits for a while and just stick with the sixty-something as a party trick.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22389278164</link><guid>http://www.sowbug.com/post/22389278164</guid><pubDate>Fri, 04 May 2012 10:26:01 -0700</pubDate><category>random</category></item><item><title>Don't make this mistake with Arduino streaming APIs</title><description>&lt;p&gt;This happened to me. Don&amp;#8217;t let it happen to you.&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Write a constant somewhere, like Wire.write(0x06). In my case, this was sending an address to an I2C chip, but it could be Serial.write() or something else like that.&lt;/li&gt;
&lt;li&gt;Confirm everything&amp;#8217;s working great.&lt;/li&gt;
&lt;li&gt;Later on, change to Wire.write(0x00).&lt;/li&gt;
&lt;li&gt;Get a compile error about how the function signature is now ambiguous because zero can be any of multiple types.&lt;/li&gt;
&lt;li&gt;Be specific: Wire.write(0x00, HEX).&lt;/li&gt;
&lt;li&gt;Confirm everything&amp;#8217;s working great.&lt;/li&gt;
&lt;li&gt;Now copy your earlier code somewhere else: Wire.write(0x04, HEX).&lt;/li&gt;
&lt;li&gt;Your I2C device begins emitting lethal radiation focused on nearby kittens.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;The mistake started with step 4 (misinterpreting the compile error) and its fate was sealed with step 5. The problem is that the Arduino&amp;#8217;s print/println methods are slightly different in that they take an optional format argument as the second parameter if the first doesn&amp;#8217;t fit a single function signature. The streaming APIs, on the other hand, take a pointer and a length. So my Wire.write(0, HEX) was actually Wire.write(address 0, 16 bytes). In Step 6 I just got lucky that whatever I wrote to the device didn&amp;#8217;t change behavior much, but Step 7 my luck ran out.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TL;DR: print takes a format specifier. Streaming libraries take a length. If you mix them up, it still builds.&lt;/strong&gt;&lt;/p&gt;</description><link>http://www.sowbug.com/post/22385894622</link><guid>http://www.sowbug.com/post/22385894622</guid><pubDate>Fri, 04 May 2012 08:54:48 -0700</pubDate><category>arduino</category></item><item><title>OK Wake as its own breakout board</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m3dj6d2Yz91qjj3vh.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;I am not usually this smart. I was fretting about how to get accessible pinouts to the tiny SOIC-8 PCF8523 while developing the OK Wake firmware on an Arduino. I thought about dead-bug wires, or picking up an SOIC breakout board from a local store, or doing something ugly with perfboard. I briefly explored repurposing an old unpopulated PCB, like maybe the third Hypna Go Go PCB from Laen, which uses an SOIC-8 for its ATtiny13a.&lt;/p&gt;
&lt;p&gt;Then I realized that the OK Wake itself was the perfect board! Just connect the ATtiny socket&amp;#8217;s pins to the corresponding pins on the big brother Arduino. That&amp;#8217;s what I did, and it&amp;#8217;s working very nicely. And as a bonus, I didn&amp;#8217;t have to sacrifice any PCBs or extra PCF8523s.&lt;/p&gt;
&lt;p&gt;Kind of obvious in retrospect. But in mental cycles expended, I definitely earned it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[Update from a couple hours later] &lt;/strong&gt;I&amp;#8217;ve successfully done the following:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Using the Arduino&amp;#8217;s Wire I2C library, read the seconds from the &amp;#8216;8523 and confirmed that they increment properly.&lt;/li&gt;
&lt;li&gt;Turned off the CLKOUT default settings, which were messing up /INT.&lt;/li&gt;
&lt;li&gt;Set SIE, which enables the once-a-second interrupt on /INT.&lt;/li&gt;
&lt;li&gt;Configured TAM to pulse the /INT interrupt so I don&amp;#8217;t have to clear it.&lt;/li&gt;
&lt;li&gt;Confirmed with my logic analyzer that the pulse is indeed 1/64 seconds long.&lt;/li&gt;
&lt;li&gt;Got the Arduino firing an interrupt routine when /INT goes active.&lt;/li&gt;
&lt;li&gt;Confirmed that the button and the &amp;#8216;8532 /INT signal don&amp;#8217;t interfere with each other.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;In other words, unless the ATtiny is weirdly different from the &amp;#8216;328, then the circuit is in perfect working order.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22324181409</link><guid>http://www.sowbug.com/post/22324181409</guid><pubDate>Thu, 03 May 2012 09:13:07 -0700</pubDate><category>OK Wake</category><category>electronics</category></item><item><title>First two OK Wake boards. I assembled them and wrote a quickie...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m3bws8oKA11qly645o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;First two &lt;a href="/post/21150945583/ok-wake"&gt;OK Wake&lt;/a&gt; boards. I assembled them and wrote a quickie program to test that everything was wired up properly. I haven’t yet run the PCF8523 real-time clock through its paces, but everything else is working properly.&lt;/p&gt;
&lt;p&gt;This board is going to require some nontrivial firmware, and I haven’t ever worked with I2C (or the generic-brand TWI, or two-wire interface) on an AVR, which means this is going to be a significant opportunity to learn. Because I didn’t have the space for an ISP header, I’ll probably develop most of the firmware on an Arduino or Adafruit ‘32u4 breakout board to avoid having to constantly unplug the ATtiny25. That will speed up development time, I hope.&lt;/p&gt;
&lt;p&gt;I did make one mistake in this circuit. I had a half-baked idea that a 10uF capacitor could power the RTC during battery changes. I have absolutely no basis for my belief that that capacitor is large enough to power the RTC during the 30 seconds it’d take to change the battery, but even if it were, I neglected to put a diode in the circuit to stop the ATtiny from quickly draining the capacitor. This probably means that changing the battery will be disruptive. Fortunately, I expect the lifetime of the battery to exceed the useful lifetime of the board (remember, this is for a friend’s children who aren’t yet old enough to read a clock but are likely to respect a color-coded admonition to stay in bed, and I’m sure that in a year they’ll have grown out of that phase).&lt;/p&gt;</description><link>http://www.sowbug.com/post/22258822476</link><guid>http://www.sowbug.com/post/22258822476</guid><pubDate>Wed, 02 May 2012 08:07:42 -0700</pubDate><category>OK Wake</category><category>electronics</category></item><item><title>Hypna Go Go Scares the Crap Out of Me</title><description>&lt;p&gt;A couple nights ago I had my first &lt;a href="/post/20906913903/the-hypna-go-go"&gt;Hypna Go Go&lt;/a&gt;-influenced dream. I don&amp;#8217;t remember what had been happening in the dream, but suddenly a bright drag-race-Christmas-tree-style pole of lights appeared right in front of me. I realized that this was my signal that I was dreaming. Unfortunately, I couldn&amp;#8217;t shake my dream-world concern &lt;em&gt;why&lt;/em&gt; the big red lights were flashing; was it an ambulance? Was it a traffic jam or an accident? Were my family members hurt? The next couple moments of the dream were vague and unpleasant, and I woke up.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not going to change anything with the device for now. Yes, the lights are probably a little too bright, but having replayed the light-pole event in my mind several times while awake, I believe I can train myself so that next time it won&amp;#8217;t be a distressing experience.&lt;/p&gt;
&lt;p&gt;Incidentally, I&amp;#8217;m getting pretty good at dream recall. I&amp;#8217;ve written down about ten dreams, and have been aware that I&amp;#8217;ve forgotten nearly as many more. This is much better than a few weeks ago, when it seemed that I had no dreams at all. And lately I&amp;#8217;ve been having a sense of general well-being about the world, which I would expect given that my dreams are often about seeing old friends and being in interesting places. Or maybe it&amp;#8217;s because it&amp;#8217;s Spring in my part of the world.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22196546683</link><guid>http://www.sowbug.com/post/22196546683</guid><pubDate>Tue, 01 May 2012 08:51:01 -0700</pubDate><category>Hypna Go Go</category><category>dreams</category></item><item><title>The first PCB version of the Hypna Go Go works just fine!</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m3boggpvBe1qly645o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;The first PCB version of the &lt;a href="/post/20906913903/the-hypna-go-go"&gt;Hypna Go Go&lt;/a&gt; works just fine!&lt;/p&gt;</description><link>http://www.sowbug.com/post/22168656460</link><guid>http://www.sowbug.com/post/22168656460</guid><pubDate>Mon, 30 Apr 2012 19:33:50 -0700</pubDate><category>Hypna Go Go</category><category>electronics</category></item><item><title>Awesome work on JTAGWhisperer!  Been reading all about this project and ran into a hitch. First my setup...  I'm using an Arduino Duemilanove with 4 channel bidirectional logic level converter and trying to program my Taio xilinx Coolrunner II (XC2C64A).  I get the ready to send output, and then confirmation that the device is ready.  After that it freezes after sending 32 bytes, no matter what xsvf I try and program to the CPLD.  TDO is high at 3.3v on the CPLD, but just hangs.  Any thoughts?</title><description>&lt;p&gt;When I was debugging this thing, the Arduino serial connection (which uses software flow control, a.k.a. no flow control) was getting confused or falling behind. Try setting both sides to a very low bitrate (like 9600 or 2400).&lt;/p&gt;
&lt;p&gt;Do you have a logic analyzer? That was invaluable in isolating problems.&lt;/p&gt;
&lt;p&gt;Are you sure that the target board doesn’t have any jumper/power requirements? My board needed two power sources: one for the core, and one for the I/O.&lt;/p&gt;
&lt;p&gt;The smallest possible XSVF is one asking for the device ID and ending. That one’s also attractive because it doesn’t involve writing (which can be very finicky about voltage levels).&lt;/p&gt;
&lt;p&gt;Be sure your XSVFs are generated specifically for your chip. The ones in the repo are for a XC9572XL, which is incompatible.&lt;/p&gt;
&lt;p&gt;That’s all I can think of right now. &lt;/p&gt;</description><link>http://www.sowbug.com/post/22056532276</link><guid>http://www.sowbug.com/post/22056532276</guid><pubDate>Sun, 29 Apr 2012 09:47:22 -0700</pubDate></item><item><title>Making more geeks, one geek at a time</title><description>&lt;p&gt;Please pardon a slightly off-topic post. This isn&amp;#8217;t about electronics, but it&amp;#8217;s about making more people who might make electronics, so it&amp;#8217;s almost relevant.&lt;/p&gt;
&lt;p&gt;Saturday afternoon my seven-year-old son asked if I&amp;#8217;d let him play Quake 3 on my desktop computer. I said sure and walked him through bringing up the Ubuntu Unity menu, typing in &amp;#8220;ioquake,&amp;#8221; and so on, until he&amp;#8217;d started a multiplayer game populated with several bot enemies. All was well and I returned to fiddling with &lt;a href="https://www.twilio.com/"&gt;Twilio&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Then came the Tech Support call: &amp;#8220;DAD!!!&amp;#8221; My son had navigated down into some odd menu I&amp;#8217;d never seen, and both of us needed some time to figure out what was going on. We hit escape, got our bearings, and he was back manufacturing gibs once again. I told him to stick to the main options in the menu.&lt;/p&gt;
&lt;p&gt;&amp;#8220;OK, Dad.&amp;#8221; And back to Twilio.&lt;/p&gt;
&lt;p&gt;&amp;#8220;DAD!!!&amp;#8221;&lt;/p&gt;
&lt;p&gt;This time he&amp;#8217;d done something kind of interesting. He&amp;#8217;d opened the Quake console and had gotten into some state that seemed unrecoverable except for quitting. I was about to repeat my &amp;#8220;stick to the main&amp;#8221; admonition, except this time phrased as a &amp;#8220;because I&amp;#8217;m Dad &amp;#8212; now it&amp;#8217;s a rule &amp;#8212; disobedience forbidden &amp;#8212; on pain of punishment&amp;#8221; kind of parental edict.&lt;/p&gt;
&lt;p&gt;Fortunately, I caught myself, just before the words left my mouth. &lt;em&gt;My son was doing exactly what I used to do when I was learning computers.&lt;/em&gt; He was exploring every path in the UI, seeing what would happen, &lt;a href="http://www.amazon.com/gp/product/1936719002/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=sowbug-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=1936719002"&gt;poking the box&lt;/a&gt;. This was hacking. This was the satisfaction of curiosity, the development of proficiency, the beginning of true understanding. This was my son being a geek.&lt;/p&gt;
&lt;p&gt;My irritation subsided. Awe replaced it. I stepped back, literally and figuratively. I nudged him a bit to get him unstuck, as he&amp;#8217;d asked me to, but I let him keep exploring the &lt;em&gt;real&lt;/em&gt; game that he wanted to play &amp;#8212; the user interface of this shoot &amp;#8216;em up.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22053868821</link><guid>http://www.sowbug.com/post/22053868821</guid><pubDate>Sun, 29 Apr 2012 09:05:57 -0700</pubDate><category>geek</category></item><item><title>Hi Mike, This is really cool (JTAG Whisperer). I am really interested in trying this out with a Teensy 2, wwwpjrccom. I have a couple on hand right now. Those will run "serial" at about 1.1 MByte/sec. Jack also sent me a C\Wing board... so I can try programming it. Question: the Python side of things. What do I need to do to set up Python, where is your code, etc. I have never done Python. I do like communicationg with Arduino thru Microsoft's free C# Express. That might be another option...</title><description>&lt;p&gt;Python’s at &lt;a href="http://www.python.org"&gt;www.python.org&lt;/a&gt;. The blog links to the GitHub project, and it’s the top hit on Google for “jtag whisperer.” If you have trouble running it, let me know. I’m not going to be the best authority on setting up Python, but there are (probably) a zillion howtos out there. Good luck and let me know how it goes!&lt;/p&gt;</description><link>http://www.sowbug.com/post/22021843390</link><guid>http://www.sowbug.com/post/22021843390</guid><pubDate>Sat, 28 Apr 2012 19:32:44 -0700</pubDate></item><item><title>Where to buy?  ... i want it nowwwwww!</title><description>&lt;p&gt;Hi there, thanks for writing. Which project are you talking about? I’m working on about a half-dozen right now.&lt;/p&gt;</description><link>http://www.sowbug.com/post/22021722706</link><guid>http://www.sowbug.com/post/22021722706</guid><pubDate>Sat, 28 Apr 2012 19:30:51 -0700</pubDate></item><item><title>Hello World on STM32F4 Discovery</title><description>&lt;p&gt;I got a blinking LED (the embedded Hello World) on my &lt;a href="http://www.st.com/internet/evalboard/product/252419.jsp"&gt;STM32F4 Discovery&lt;/a&gt; board. It probably would have been easy to do, except that I was on OS X. Here are the steps I took:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Tried a bunch of stuff.&lt;/li&gt;
&lt;li&gt;Switch to Linux.&lt;/li&gt;
&lt;li&gt;Tried a bunch more stuff.&lt;/li&gt;
&lt;li&gt;Took a break.&lt;/li&gt;
&lt;li&gt;Found this &lt;a href="http://www.triplespark.net/elec/pdev/arm/stm32.html"&gt;extremely correct page&lt;/a&gt;, which helped me build a real ARM toolchain.&lt;/li&gt;
&lt;li&gt;Built &lt;a href="https://github.com/esden/summon-arm-toolchain"&gt;stlink&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Built some of the stlink samples.&lt;/li&gt;
&lt;li&gt;Got gdb going with the stlink gdbserver.&lt;/li&gt;
&lt;li&gt;Stepped through some code in RAM (not flashed).&lt;/li&gt;
&lt;li&gt;Using the stlink flash utility, flashed code I built to the board. Unplugged it and plugged it back in to confirm the code was still there.&lt;/li&gt;
&lt;li&gt;Flashed back the &amp;#8220;Discovery&amp;#8221; sample shipped with the board.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;From this adventure I can confirm that summon-arm-toolchain does work if you switch to the dev branch, and that the ARM version of gdb really and truly allows interactive debugging on this tiny little dev board. Quite a step up from the AT90S4433 and early avr-gcc toolchain that I first started hacking on back in 2002.&lt;/p&gt;</description><link>http://www.sowbug.com/post/21786386289</link><guid>http://www.sowbug.com/post/21786386289</guid><pubDate>Wed, 25 Apr 2012 09:01:54 -0700</pubDate><category>gizmos</category><category>arm</category></item></channel></rss>

