I’ve pondered creating something like this a bunch of times: a way to visualize all the satellites currently in Earth orbit. Somebody beat me to it, using Google Earth and a .kml file. It’s pretty astounding just how packed low earth orbit is, and it’s cool to check out the band of geostationary satellites as well.
October 18, 2011 | Arduino | By: Mark VandeWettering
I had an idea for a project that doesn’t require a full Arduino: a small 8 pin processor would work just fine. But how to program them? It turns out you can use an Arduino as a programmer. Check out the instructions:
Sadly, I only have the ATtiny13’s lying around: you need a bit more flash space to use the Tiny Arduino library. Still, pretty neat, and getting the slightly larger devices only costs about $2.25 each, quantity one from digikey.
Addendum:Here is another sketch that turns the Arduino into a programmer that can be used with AVRdude. I’ve written some simple programs using avra: perhaps it is time to dust off those skills…
I was going to tidy up my breadboard layout for the satellite tracker I’ve been working on, and I thought it might be nice to use some software to test out various layouts. It also has the side effect of documenting the circuit, at least minimally. I decided to give Fritzing a try, which is compatible with my low attention span and skill level.
Here’s my first attempt: it doesn’t include the rotary encoder that I put on the board, because it appears I’ll have to setup a custom component to make it work. But as far as it goes, it’s not bad. They already had the Sparkfun RTC clock board that I used, and I just reused a generic 8 pin IC for the AT24C1024B that I wired onto the I2C bus. 5V supplies are all red, grounds are black, and yellow and green are the serial data and clock signals respectively.
When the project is complete, I’ll make the fritzing file available.
I must admit, I had my misgivings about the prospects of a movie based upon Michael Lewis’ book Moneyball. After all, Moneyball is a book about how Billy Beane took the Oakland Athletics to unheard of success on one of the most meager payrolls in the major leagues using a (then) unconventional view of baseball based upon discovering and exploiting inefficiencies in the market for players. How can that be turned into a movie?
And yet, they did. And it’s a great movie.
Mind you, part of it is my own nostalgia and romance for the game. I was a budding fan of baseball during this era of Athletics baseball. I watched Hudson, Mulder, and Zito. I cheered Chavez, Tejada and both Giambis. I was amazed by Koch and Bradford. I grew to love and appreciate the beauty of the game. I enjoyed the story of each season as it unwound. The glorious victories. The agonizing defeats. I still love this part of the game.
But it was more than just the on field game. I started reading. I got exposed to the works of Bill James and sabermetrics. Here was a guy who tried to systematically understand the game, and why it was the way it was. To really be able to say something definitive about the players, and how to evaluate them. The approach appealed to me, and gave me insights that I didn’t have before. It helped explain why the Athletics did what they did.
And I began to appreciate the business game. How clever, low payroll teams could still compete against big market teams like the Yankees.
But how could you make a movie that conveys all these things on screen?
Well, the Moneyball story is a fascinating story. And Aaron Sorkin has done an amazing job of adapting it to the screen. Brad Pitt does a great job portraying Billy Beane. And in the end, I was blown away at how powerful the movie was.
I know part of it is my own love for my adopted home team. It’s awesome to see angles of the Oakland Coliseum up on the big screen. It’s not like Fenway, which seemingly appears in every movie of baseball. The Coliseum isn’t an immaculate temple to baseball. It isn’t even that historic. But it’s where I remember seeing some amazing baseball, and where I grew to appreciate and love the game. And as I watched it in a theater in Emeryville (an Oakland suburb), I could tell that some of the audience members (a suprisingly large number) felt it too.
When people asked me what the greatest baseball movie was, I always used to say Bull Durham. That’s still a great movie, but Moneyball may in fact be greater. Greater because it’s a true story, about the real game. If you have any love of the game, watch it. If you don’t have any love of the game, give it a try.
October 14, 2011 | Arduino | By: Mark VandeWettering
In seeking some more details on the inner workings of the Wire library for the Arduino, I chanced across this rather informative link on the Arduino Playground website:
Of particular interest to me was the description how requestFrom worked. It doesn’t just issue the request: it calls the low level twi_readFrom() command to read the bytes requested from the I2C device. Thus, in the case that troubled me before, the bytes are guaranteed to be there.
Or are they? What if you ask for too many? The documentation says the I2C slave will NACK the read request. Well, what happens there? Let’s see what the code looks like…
The twi_readFrom() call is from the underlying avr_libc library, which seems every bit as inscrutable. I haven’t dug deep enough to know for sure, but I suppose it is possible for twi_readFrom to return a value less than the number requested, or even zero in case of a NACK. In that case, the code that I was complaining about would still “work”, although it would call Wire.available() repeatedly (length times) to no avail, and leave the buffer empty.
It’s also good to note that the routine silently trims requests to match an internal buffer length. In theory, the AT24C1024 can write 256 bytes at a time, but the internal buffer lengths are set to 32.
Check out this two line fragment from the read function:
for ( c = 0; c < length; c++ )
if (Wire.available()) buffer[c] = Wire.receive();
Is anyone else struck by the fact that it is, well, just wrong? The I2C device is expected to be sending "length" bytes. This loop checks to see if a byte is available, and if it is, then sticks it in the buffer. But what happens if it is not? Then the index increments, and when we try again, any particular byte we write will be placed at a strange location in the buffer.
The only way this code makes sense is if Wire.available() never fails. If it does, then it will leave an empty slot in the output array.
I'll have to step through the Wire library source to make sure, but this seems wrong to me. I'll let you know what I find.
I really like librivox.org. For those of you who may not have heard of it before, it’s an effort to take works in the public domain and record them as mp3 and ogg files for anyone to download. It’s an awesome resource: I’ve listened to many of their recordings, and while the quality can be somewhat variable, most are excellent and well worth downloading.
Today I found a couple of interesting items though that were a bit different than their normal literary fare. When you are recording for librivox or a podcast or whatever, the questions always come up: “what recorder should I use?” and “what microphone should I use?” To answer that question, librivox merely accepted submissions of the same poem being recorded by different devices and through different microphones, and let you hear the difference and decide for yourself.
It is a bit difficult to normalize the results, as the recordings were done by different people in different places at different time, and with differing amounts of post processing, but you can consult the links to both project’s websites to gain more information. Pretty neat!
He does have a point, and it’s a point that I’m willing to concede: that asking the very rich for advice on how to run your life is probably not very helpful or realistic. They will tell you a story of their personal adversity, about how they stuck with it, about how the odds were stacked against them, and how they ultimately prevailed.
Of course, you don’t hear the stories of the millions who also followed their dreams, and yet still ended up living in their parents basement.
Steve was bold, brash and talented. He had a real vision. And he was also lucky. When we listen to stories of successful people (in politics, in business, in music, in sports) we often are told these kind of character lessons. We believe that if we emulate these successful people, we’ll be successful too. We ignore the (substantial) role that circumstances and luck play in success.
So I urge people to be cautious about drawing too many life lessons from the writings of the rich and successful.
But Kyle Smith swings way far in the other direction, and in a way that is perhaps predictably cynical, given the industry into which is article is targeted. He relates the story of a Gretchen Neels, who informs a group of prospective employees that the way their employers describe them is “entitled”. This is a common enough complaint (particularly among the WSJ and Forbes target audience), but I would submit two things for your consideration:
Young people are entitled to a better world than the one we are giving them. Our current political and financial institutions are failing them in a huge way. We’ve sold them on the idea that acquiring debt to become educated will pay off. That the things that are keeping them back is due to government meddling in their affairs, and the taxes and regulations that their employers have to pay. That’s not just wrong, it’s a lie, and young people are entitled to better from the world that they inherited. My grandparents and parents both thought their kids were entitled to a better life because that is what they worked for. The nation and its political institutions have failed everyone, but perhaps have disproportionately failed young people.
We should remember that there are two sides of this perception. Maybe the kids do feel they are entitled, but it’s also convenient for businesses to characterize their workers that way. It is an easy excuse for doing things to your employees that might otherwise give you pause. You end up saying things like, “hey, you aren’t entitled to a living wage” or “you aren’t entitled to respect or honesty in dealing with our business”. It’s just another way that employers have been dehumanizing their employees.
Smith is right about one thing: Jobs made a bad choice in not pursuing evidence-based treatment for his cancer. It is a tragedy that even the smartest among us often have some crazy ideas, and pursue them even at a very high cost to ourselves. Sadly, many of these ideas are quite pervasive, such as the idea that lowering tax rates creates jobs, or that immunizing young women for HPV increases sexual activity among teens. Jobs’ particular arrogance was at least primarily directed in his own private life, and while I do view it as tragic, I’m not particularly appalled by it, nor does it invalidate the many great things that Jobs created, and to the philosophy that he expressed via his public speaking (such as the often cited Stanford commencement address).
Many in the business world don’t seem to like the Stanford Address very much, and I suspect that it’s because they don’t actually understand it. It’s not intended as a recipe to make the next great CEO: it’s intended to challenge young people to make the world better. His message is different than the message sent by the WSJ and Forbes. His message was that if you want to change the world, you can only do it by doing what you love. It’s not a recipe for business success: it’s a recipe for happiness. Watch that video again: here’s a guy who was battling pancreatic cancer, and yet who was also experiencing perhaps the greatest period of creativity and success in his life. He was doing what he loved, and I think he was pretty damned happy about it.
If there is one overriding perception of the millennial generation, it’s that these young people have great — and sometimes outlandish — expectations. Employers realize the millennials are their future work force, but they are concerned about this generation’s desire to shape their jobs to fit their lives rather than adapt their lives to the workplace.
Frankly, I hope that the so-called millennials will prevail. The business, political and financial world have been telling young people that they have too high expectations, and in my view, it’s mostly to justify their own thievery of the future from our young people. We’re asking them to do more for less. That they aren’t entitled to better. That as individuals they aren’t important enough, so as individuals we are okay with letting them fail.
I hope I live long enough to see the world swing to a different view.
October 12, 2011 | Arduino | By: Mark VandeWettering
Yesterday, I got delivery of my Xbee modules from sparkfun, and decided to try to see if I could do something with them. My ultimate goal is to use them to connect my satellite tracker to a PC which is hooked to the Internet so that the tracker can automatically receive updates to orbital elements and the like. But for the evening, I decided to just see if I could get them to work at all.
An Xbee shield, for piggy backing an Xbee onto the Arduino. I should have read the product description carefully: you’ll need to add some headers to actually connect it to an Arduino board: luckily, I had a proto shield I hadn’t assembled, so I swiped those, and then ordered some spare ones from sparkfun.
(Instead, you could just have ordered this retail package and gotten all of the above, including the headers you need.)
Okay, you’ve got all that in front of you, what do you do? Well, you solder the headers in place. I plugged the new headers into another shield, put the board on top, and then quickly soldered the 28 connections. A quick inspection revealed my normally fair soldering had left a cold joint or two, which I touched up.
What next? Configuration! I plugged an Xbee into my Xbee Explorer, and configured it. About half the tutorials I read downloaded the Xbee configuration utility X-CTU, but as I started that, I realized it was over 48 megabytes. Pffft! Just to set a few bits in the microcontroller? Other utilities mentioned that you could use something like the old Hayes “AT” command set to configure them using just a terminal program, so that’s what I did.
I fired up PuTTY, told it to talk to the serial port, and turned on echo. I then configured the 16 bit ID for the module by typing “ATMY1234”, the 16 bit destination by setting “ATDL5678”, and the network id by “ATID1111,”. Each entry echoed “OK”. I then typed “WR” to write the results to EEPROM on the Xbee.
I then extracted the first Xbee module and plugged it into the shield. I then programmed the second one, but instead told its ID was 5678 (ATMY5678) and its destination was 1234 (ATDL1234). I programmed the same network ID and wrote it to the Xbee module.
Okay, now what? Well, I left PuTTY running on the PC with the USB Explorer. I powered down my satellite tracker and detached the current maze that connects to the breadboard containing the RTC, and then plugged in the Xbee Shield. I then reconnected the RTC clock and powered on the new stack.
No smoke. No fire. Lights blinking. Clock seems to work as before.
And staring over at the PC, the status messages that previously had appeared via the serial monitor are now going out over the wireless to an entirely different PC. Success! First try!
My use case was very simple: I really just wanted to eliminate a wire in the simplest way possible. Xbee is very easy to configure to do that. In fact, you can develop your entire sketch for the Arduino without any concern for Xbee at all: just use the serial port. In my case, I want to create an application (probably in Python) to periodically fetch elements and feed them to the tracker at intervals). I can use PySerial to talk directly to the Arduino, and not worry about the wireless at all. When I’ve got that all debugged, I just plug in the Xbee shield, plug in the Xbee explorer to the PC, and everything works exactly the same (no software changes at all).
Of course, my use case is pretty simple, and Xbee can do a lot more. It can (for instance) monitor a set of analog/digital pins, and automatically beacon them to another xbee module, all without any microcontroller at all. Or you can configure a couple of pins as output, and signal them. There are various broadcast modes you can use. Cool stuff.
If you want to deploy and Arduino + Xbee together, there might be a cheaper way to go: the Arduino FIO. (I have one of these from osepp.com.) Cool thing is that they have an Xbee socket mounted underneath it, and include a battery charge circuit so you can attach a lithium polymer battery to it, and charge it via the mini-USB connector. Not so cool? The USB plug isn’t for programming: you’ll need an FTDI cable to program it (which is a bit of expense up front). It also doesn’t have the standard Arduino footprint, so you are out of luck if you want to use standard shields. Still, I think I can find some use for it.
Satellite Tracker Update: I think I have a slow memory leak somewhere. After running for several hours, my tracker simply halts. By printing status messages, I found that it wasn’t the Gameduino which was locked, it’s the Arduino. I’ll instrument it a bit more carefully and do some debugging. I might also institute a watch dog timer reset to blunt the problem. Stay tuned.
Addendum: If you need some additional help, you might try using Jeremy Blum’s Arduino tutorial videos, which shows the process step by step. I watched these a couple of days ago, and while I didn’t refer to them again while setting this thing up, I essentially followed his exact steps, including the use of PuTTY. Jeremy also did an awesome appearance on the ZombieTech podcast. He’s a very talented guy.
Steve Jobs, the pioneer of the computer as a jail made cool, designed to sever fools from their freedom, has died.
As Chicago Mayor Harold Washington said of the corrupt former Mayor Daley, ‘I’m not glad he’s dead, but I’m glad he’s gone’. Nobody deserves to have to die – not Jobs, not Mr Bill, not even people guilty of bigger evils than theirs. But we all deserve the end of Jobs’ malign influence on people’s computing.
Unfortunately, that influence continues despite his absence. We can only hope his successors, as they attempt to carry on his legacy, will be less effective.
I didn’t really find it surprising that Stallman would have some harsh comments regarding Steve. They represent two diametrically opposed views about computing after all. Stallman believes that anyone who hides any details about your computer from you is robbing you of your freedom. Jobs was slightly less of an ideologue, but was no real fan of that kind of free software, and was certainly comfortable with enforcing intellectual property rights to blunt competitors.
The odd thing is that I have some respect for both men, even though I disagree with some of their ideas most whole heartedly.
Stallman is an ideologue, in both the best and worse sense of the word. His work was absolutely fundamental in shaping the landscape of the open source and free software movements, but very early I diverged with his views. To me, software is like any other creative work protected by copyrights: it is ultimately the author who decides how and by whom it may be used. The users have no default rights. If they choose to accept the terms under which the authors distribute a work, then there is no basis for complaint.
Ultimately, I found that the model that the GNU license upheld was for me simply not free enough. The GPL is coercive in a way that I don’t find particularly attractive: it says “look, if you want to use my stuff, you have to let me use your stuff”. And of course it uses the copyright system itself (which is one of the ways that companies hold power over users) to gain a legal basis to enforce that idea.
I’ve always found the BSD license to be far more attractive, and I use it for my own works that I release. The basic idea is that you shouldn’t pretend that you wrote anything that you didn’t, so don’t do that. Give the authors their credit, but then feel free to build on what they did. I’ve found that to be more akin to my own goals and ethics.
Steve (and by extension Apple) wasn’t a huge fan of either of these models, although Apple certainly benefited by adoption of some free software projects. But if I was going to really complain about Apple, it’s more about the idea that they insist on interjecting themselves as intermediary in the process of software distribution. Even if I wish to give my software away, I have to get Apple’s permission to let anyone else use it. That’s seriously not good.
But as in all decisions one makes, ultimately you have to make a pragmatic decision. I have an iPhone despite my fundamental disgruntlement, because in the long run it still saves me time, and provides me with enough of value that I think it’s the best product for me to buy. Far from being “jailed”, I simply have made a pragmatic choice, and it’s presumptuous for people like Stallman and Raymond to claim otherwise.
There are worse things to be in than a walled garden. As long as you have the freedom to leave, calling it a jail is just pointless hyperbole.
October 11, 2011 | Amateur Radio | By: Mark VandeWettering
While I’m still trying to shake a respiratory infection, I’m hoping that by the weekend I’ll be hale and hearty enough to attend this years Pacificon 2011. It’s a bit of a drive for me in the North Bay, so I suspect I might be there only for Saturday, but it’s remotely possible I’ll try Sunday as well. If any readers are going to attend and want to contact me and maybe say “hi” or go have lunch, feel free to contact me beforehand via email, or via twitter (@brainwagon) during the conference. I’ll also be wearing my spiffy K6HX nametag, and probably a hat with all sorts of nutty pins stuck in it.
The great thing about doing a real project like my satellite tracker is that it makes you learn a lot, in a whole lot of different areas. In other words, it’s good exercise! And thus, it is good when you discover something doesn’t quite work right: you have another opportunity to learn.
Well, today, something wasn’t working right.
Every three minutes, the “active satellite” dot would pass one of the balls on the track. The “track dot” would then get recalculated to the time 2 hours in the future. But I noticed that occasionally, that dot would appear somewhere wrong: a point clearly off the track. It’s of course possible that I had a bug. But I also remembered that this didn’t happen before I placed an LED on the square wave output of the DS1307 real time clock chip I have wired in.
That got me thinking: could some kind of power glitch be occurring that’s causing an error when the program reads the time from the I2C bus? So, I pulled the LED out, and left it running. It’s an hour and a half later, and the glitch has not reoccurred. Interesting.
So, I got to thinking. I didn’t bother putting in any pull up resistors on the I2C bus (laziness, and lack of understanding about how important they are). I realize that the I2C bus is open drain: either the master or the slaves can pull the line down, but perhaps the LED adds enough capacitance to keep the signals from returning to high quickly, which causes a communication error? I suspect it might be informative to check out the signals on my oscilloscope. Stay tuned, but any gurus can go ahead and tell me what’s going on in greater detail, or pointing me to materials that will spoon feed me the necessary knowledge.
Addendum: Stuck in a pair of 10K pullups, my glitch did not reoccur. I should hook it up to a scope and see the difference it makes, but for now, I’ll just consider the problem fixed.
October 9, 2011 | Arduino | By: Mark VandeWettering
There is a lot to like about the Arduino, but I can’t help but think that the existing library system removes some of the power that the AVR could supply in its effort to handhold new users. I’m not the only one: the guys over at makehackvoid.com have written a new set of runtime libraries that are more efficient to help. I haven’t had a chance to use these in a projects, but I’m leaving this bookmark here so when I get around to it, I’ll consider it.
I need to think up a better name for this project. Calling it the “Arduino/Gameduino Satellite Tracker” is just too damned cumbersome for words.
Progress was slow today. I woke up around 4:00AM with a sore throat and a miserable cough. A quick trip to the urgent care clinic when it opened reassured me that I didn’t have strep throat, but I do have some kind of upper respiratory infection going. Lots of rest today. I did spend a couple of hours listlessly programming and watching the Tigers/Rangers game though, the main result being I now plot the position of the sun on the map:
While the text at the bottom still says “ISS”, the satellite being tracked is actually AO-51. As you can see, it is a polar orbiting satellite, and reaches much greater latitudes than the ISS.
I’ve been trying to remodularize the original Plan 13 code in BASIC, and that has made me go through the code and restructure it a bit. The solar calculations in Plan 13 are actually a bit odd: it goes through the trouble of converting the sun’s orbital elements into the same epoch as the satellite you are watching, mostly so you can reuse the “T” variable. It’s actually quite a bit simpler to just use the sun’s orbital elements directly, and that means the sun can be a completely independent object.
I’ve also got a bit more hardware on the way. I decided I wanted to store a fairly large number of satellite elements, so I ordered some AT24C1024 serial EEPROMS with a capacity of 128Kbytes. I can easily chain up to 4 of those together, to store 512K which should be more than enough.
I’ve also got some Zigbee radios coming, so I can send new orbital elements and synchronize the time easily from my desktop. (It’s mostly an excuse to play with Zigbee, but it will make for a nice setup).
After the clinic this morning, I stopped by Fry’s in Walnut Creek and found that they carry OSEPP’s clones of the Arduino. I’d rather spend my money at Sparkfun, but it’s nice to have a local supplier for those moments where immediate gratification is essential. I bought one of their OSEPP FIO boards, which have sockets in place for Zigbee modules. What I didn’t realize is that these boards aren’t programmable over USB: I’ll have to get one of those FTDI serial boards. For now, it will sit in its plastic case until I have need of it. It is cool that the FIO is actually cheaper than the Zigbee shield that I ordered. I’ll figure out some reason to use one.
I’ll shoot another video once I get multiple satellites loaded and some improvements in the user interface.
Addendum: It dawned on me that one way to test my solar calculations was to run them at the same time every day and see if the sun traced out an Analemma, the figure-eight shaped curve that you might have seen on a globe and given very little thought to. What’s cool is my simulation shows this effect pretty clearly.
I’m Mark VandeWettering, former senior technical director for Pixar Animation Studios, and (for the moment I’m a husband and father and grandfather. I like telescope making, radio, and all sorts of other things.
Latest Comments
I recall burning three or four weeks of a sabbatical getting Saccade.com on the air with Wordpress. So much tweaking…
I move my pretty useless blog to Hugo about 7 years ago, since I got frustrated at too many security…
Something I used to good effect for a while was a "Pocketmod". You take a single page, fold it a…
Bloat is a serious problem, to be sure, but I'm not aware of many modern programming languages that avoid it.…
I'm running static pages (Notepad++) and a couple instances of Wordpress, and an instance of dokuwiki, all on ubuntu on…
I recall burning three or four weeks of a sabbatical getting Saccade.com on the air with Wordpress. So much tweaking…