20130206

DIY TinyMarquee: an Attiny24 based scrolling marquee

This project uses charlieplexing and software serial to push the capabilities of the AtTiny24. The source code and design files are up on a github repository.

Other DIY LED marquee projects may be of interest, including a large one hand-routed on protoboard, one made from Christmas lights, a network enabled display, one using ping-pong balls, and one implemented in the rear window of a car.



A terminal stock ticker

The python module ystockquote pulls stock prices and other information from Yahoo finance, "get_price(stockname)". Here is a short python script that downloads and formats stock prices and writes them to a local file.

Bitmap fonts 

We need to translate text into a format that we can send to a scrolling marquee. We send raw pixels, so that we can adjust fonts and graphics without re-loading the firmware. Columns of pixel data are sent as 5-bit integers over serial. I used Gimp to draw a font and this Jython script to convert it into bit-packed integers representing columns of pixels for each letter.*


To test converting text to the bitmap font, the script "scroll" takes the scraped data and scrolls it across a simulated marquee in the terminal ( there is also the short "terminal_marquee" script which scrolls indefinitely, but updates intermittently in the background )

Hardware

The hardware consists of 90 3mm LEDs arranged in a 5x18 grid. These are driven by 10 IO lines of an AtTiny24. The remaining free IO line is used to poll and listen for serial data.

There is also a 10K pull-up resistor on the AtTiny's reset pin, and a 0.1μF decoupling capacitor near the power pins. The surface mount AtTiny bridges one row of the LED pins, a bit unusual but this allows a compact layout with through-hole LEDs. The marquee gets power and data from a USB to TTL serial adapter.


Charlieplexing

Charlieplexing is a way to drive tons of LEDs form only a few pins. Since LEDs only light up when current is passed in one direction, you can place two LEDs for every unique pair of IO lines at your disposal. This lets you drive N*(N-1) LEDs from N IO pins.**

PCB design

While it is possible to wire up the grid of LEDs by hand, I would not recommend it. Instead of going through this tedium, you can design a custom board and get it professionally fabricated. I use the free version of Eagle Cad to design and prepare boards for manufacture. A full Eagle tutorial is beyond the scope of this writeup, but numerous tutorials can be found elsewhere online. The Eagle design files for this project can be found here.




Exporting gerber files for board fabrication

One you have finalized a board, you need to prepare design files for fabrication. PCB designs get exported to so called "Gerber" files, which are like the PDFs of circuit board design. Once you have these files you can send them off to a fab house for production. My favorite tutorial for this is on Hackaday.

For one-off boards, BatchPCB is the go-to place. For small runs, consider Advanced Circuits or Seeed studio's Fusion PCB service. For larger runs (more than 30), depending on board size, Goldphoenix is the place to go. Depending on which service you choose, you should get boards in a few days to five weeks. I used Seeed because it is relatively cheap, and it took about a month to ship to the US.

Part sourcing 

For cheap LEDs I use Ebay. For all other components ( especially the AVR microcontollers ), I source from Mouser or Digikey. For a low cost USB to Serial adaptor, look for "USB To RS232 TTL PL2303HX" on Ebay . These are cheaper than, say, an FTDI cable from Sparkfun, and have worked great for me. I'd hoped to save a few bucks by using charlieplexing and the AtTiny14 in the design -- the total cost of each board, shipping and USB-TTL converter included, from a lot of 10, is about $7.50:
10   boards     $30   
1000 LEDs       $10   
10   AtTiny     $14   
50   Resistors  $ 1   
10   Capacitors $ 1   
10   Headers    $ 1   
10   USB-TTL    $18   
-------------------   
                $75   
       /10      $ 7.50

Cleaning the boards 

After you're finished soldering, remove any solder flux adhered to the board. Apart from being unsightly, flux can be conductive and corrosive and damage the board over time. Hackaday has a good tutorial on this. We filled an old jar with 90% Isopropanol, dunked the boards in there, and shook them around for a while -- it worked wonderfully.

Software serial 

The Attiny24 does not have hardware support for serial ( UART ), so we'll have to make a software implementation. For information about the RS-232 communication protocol, see the wiki. I used polling at twice the serial rate (4800Hz) to monitor incoming serial data, which is works for transmitting five bit packets. Further details about the firmware can be found in the C source file.

Compiling with avr-gcc 

I never remember the commands to compile and upload firmware, so here are the commands for future reference.

#compile source to a file a.o targeting the AtTiny24
avr-gcc -Os -mmcu=attiny24 ./display_serial.c -o a.o 

#extract the text and data sections to make a binary for the AVR
avr-objcopy -j .text -j .data -O binary a.o a.bin 

# check the size ( this should be smaller than the amount of available flash )
du -b ./a.bin

# upload the binary to ( in this case ) the AtTiny24 
avrdude -c avrispmkII -p t24 -B4 -P /dev/ttyUSB1 -U flash:w:a.bin 


_____________________________

*If you don't have Jython or a working JVM installed, it may be easier for you to re-enter the font as text data and write a short conversion routine in python.

**If you're familiar with multiplexing there's a simple way to conceptualize board layout for charlieplexing. When you multiplex an NxN grid of LEDs, you use N IO lines to control power to the (-) ends of the LEDs, and N IO lines to control power to the (+) ends of the LEDs.  To go from multiplexing to charlieplexing, note that microcontroller pins can take on three sates : Low (-), High (+), and Off ("high impedence"). Each IO line can serve as both a (+) line and a (-) line. What happens if we use the same N pins to drive both the (-) and the (+) a multiplexed display? Everything works fine, as long as we use the "off" state to stop current. One problem: there some LEDs along the diagonal of the matrix that have their (+) and (-) driven by the same IO pin -- there is no way to make these light up. But, no worries, since we are laying out our own board, we can just delete these LEDs, or connect their (+) terminals to a reserved IO pin to regain control of them! Charlieplexed PCB design can be relatively simple: lay out a grid of LEDs as if you were to multiplex them, but connect the N anodes to the N cathodes, and either delete the N LEDs that end up being connected to the same IO line at both ends, or wire these up to a separate IO pin to finish things off.


20130129

Three Faces of Transhumanism

Transhumanism is, broadly speaking, a philosophical and technological program that advances the position that technology should be used to enhance human mental and physical capabilities, both on an individual and species-wide basis. This is a contentious position. Critics of transhumanism have argued that it violates the divine order of the universe, degrades the human spirit, introduces unprecedented technological risks, reinforces class inequality, is insufficiently diverse, is ignorant of cultural values and its own past, represents an unjust colonization of future generations, and is scientifically untenable.

As a transhumanist fellow traveler, I will say that these critiques have some merit. It is only fair that a movement with aims somewhere between an industrial revolution and the creation of a new (and hopefully superior) sapient species take a lot of flak. But my problem with many of these critiques, as embodied by a recent scholarly book on transhumanism, is that they use a strawman version of transhumanism. Transhumanism isn’t just an ideology developed in a . Now, through the groundbreaking research practice of reading what transhumanists have to say about themselves and going to their conferences, I’ve developed a basic taxonomy of the major factions of transhumanist, Immortalists, Cryonicists, and Uploaders. I’d like to examine the program and philosophy of these factions individually.

Immortalists believe that the oldest and most important human problem is death, that death is caused by cellular aging—damage to the body on a molecular and chemical level—and that therefore reversing aging through cellular rejuvenation should be a primary research goal. Immortalists are most closely affiliated with Aubrey de Grey and the SENS Foundation.  From a philosophical and science policy perspective, I greatly admire the Immortalists. They’ve taken the basic morality of modern medicine, that death should be prevented by any means necessary, and extrapolated it to its logical conclusions. If death is not evil, but simply the final stage to life, then more resources should be invested in answering the question “What is a good death, and how do we attain it?” rather than squandered in a fragmentary struggle against individual diseases. The Immortalists do not have answers to questions like “Would an immortal species be more just or wise than mortals?” or “How will necessary change occur when the powerful never leave their positions?” or “If immortality is a limited resource, how should it be distributed?” Conversely, to argue for the necessity of death is an much more untenable position.

Cryonicists note the contemporary inadequacy of technology for undertaking the transhuman program, and focus on the cryopreservation of nearly-dead people in the present, assuming that they will be resurrected using future technology. Cryonics, most noteably associated with Max More and Alcor, are the most programmatically advanced faction. While no organism has yet been successfully unfrozen, you can sign up for Alcor’s preservation services today. Cryonicists trouble our notions of life and death, moving from heart cessation, to brain death, to information-theoretic death. A successful revival (particularly from LN2) will problem require Drexlerian nanotechnology to repair cellular damage, and it is an open question if future beings will want to have a bunch of future-shocked primitives walking around. In the present, cyronics has caused conflicts in families, and while the costs associated with preservation are not astronomical, they are high enough that it is reasonable to question if that investment would be better made in your descendents or charitable donations.

Uploaders take the position that what is significant about humans is our capacity for thought, and that the main problem with human cognition is that the brain is a crappy computer that stops working aft. By moving cognition from a neural substrate to a semi-conductor substrate, human can achieve immortality through cognitive backups, intelligence amplification via Moore’s Law, and direct experience of a whole digital universe.  Uploaders are most strongly affiliated with Ray Kurzweil and the Singularity Institute.  Uploaders have what is both the most mainstream version of transhumanism (robots and digital minds are a commonplace scifi trope), and what is also the most radical.  The Uploader program is based on several assumptions about the philosophy of mind and computer science that seem optimistic and partial at best. The first is that the best definition of identity is computation, rather than being based on any kind of physical or process continuity. Uploaders would need to prove that the mind running in silico is the same as the biological original to the satisfaction of skeptics in a way that is more demanding than the burdens placed on Immortalists and Cryonics. And for a movement heavily based in computer programming, Uploaders seem very optimistic that attempts to simulate the mind will not run afoul of limits in both computational complexity and mathematical incompleteness, and the long term viability of obsolescing computer hardware and data formats.

Compared to mainstream conceptions of humanity, all these transhumanist factions have more commonalities than differences, but the differences are very real, and should not be ignored or glossed over. In a future post, I plan to examine transhumanism more holistically as a movement and ideology, but first, I believe it import to clear up some of the political distinctions between three very different visions of the future.


20130109

Stephen Hawking and Networks in Disability Research


(photo via Wired, NASA, Flickr)
Stephen Hawking’s birthday was yesterday, January 8th.  Hawking is certainly the most famous scientist with disabilities alive today, and arguably the most celebrated person  with disabilities in history. With his motorized wheelchair and electronic voicebox, he is an iconic figure.
Wired has a fascinating article on Dr. Hawking, how he does his work, and what his life can tell us about both ‘ordinary’ scientists and people with disabilities. The full thing is worth reading, but I want to pull out some paragraphs which express what I am trying to see in my research more elegantly than I can put it myself.
In one version of Hawking’s eulogistic story, we praise the smartest person in the world, the brilliant physicist, one of the greatest cosmologists of our time. He fits perfectly well with our conception of how science and its heroes work: To be a genius all one needs is a powerful – a “beautiful” – mind. And indeed, because of his disability, Hawking embodies the mythical figure capable of grasping the ultimate laws of the universe with nothing but the sheer strength of his reasoning: He can’t move his body, so everything must be in his mind. What else would a theoretical physicist need?
But in another version of Hawking’s story, we notice that he is more “incorporated” than any other scientist, let alone human being. He is delegated across numerous other bodies: technicians, students, assistants, and of course, machines. Hawking’s “genius,” far from being the product of his mind alone, is in fact profoundly located, material, and collective in nature… What I discovered was that to understand Hawking, you had to understand the people and the machines without whom he would be unable to act and think; you had to understand the ways in which these entities augmented and amplified Hawking’s competencies.
Hawking’s persona, his disability, and his embodied network thus becomes a window on our machines, the nature of work, and even our representation of scientific heroes. Popular media shows us that Hawking is a pure, isolated, once-in-a-lifetime genius; ethnographic analysis shows us that Hawking is not that different from other scientists even though he has a disability. In fact, it’s precisely because of his disability that we get to see how all scientists work … and how the entire world will work one day.
Because, surrounded as we are by our world of technology and digital information, aren’t we all disabled? We, like Hawking… are unable to think and complete the results of our thoughts without being attached to a network of people, instruments, machines – and the living laboratories through which it is all distributed
Indeed.


20121220

To See More Clearly

A few days ago, Evan Selinger wrote an article on Augmented-Reality Racism which has been (unfortunately) gaining some traction around the web. I say ‘unfortunately’, because Evan is a sharp and insightful thinker who can translate dense philosophical ideas into nuanced and popular forms (see his July article on The Philosophy of the Technology of the Gun for a great example), and Augmented-Reality Racism is not that. Since I think there’s some merit to the premise, I’d like to take my own whack at it.

Augmented reality (AR) takes modern computing technology and puts it on the bridge of your nose, interlaying projected images and sounds with your view of the world. Evan hypothesizes that such a technology could be used in a racist manner, either to ‘erase’ people of a certain race from view or to become super-aware of their presence (pulse-Doppler blackdar?). He notes that technologies have frequently embedded racist agendas, like the example of Robert Moses’ low bridges on the Long Island Parkway, designed to block buses--full of black people from the city--from the beaches. Evan concludes by wondering if augmented realities designed to individualize and humanizing the masses in the crowd might be a good way to build social bonds and empathy.

There’s an irritating floppiness to the scenario (does racist AR obscure people or highlight them?), but more fundamentally, the article fails to think deeply about augmented reality or the relationship between technology and race. First AR: Augmented reality is much more than the visible front-end of a head-mounted display. AR (properly, Nathan Jurgenson’s definition of Mild Augmented Reality) is the belief that “The digital and physical are part of one reality, have different properties, and interact.” It’s about “Spiming” as much of the world as possible, so that the qualities and histories of objects can be viewed and understood in those nifty heads-mounted displays.

In many ways, the world is already augmented. Any surface covered with words and other signs and signifiers, which in certain places can be pretty much all of them, is already augmented. Awnings block the rain and advertise stores. Packages conceal the materiality of their contents, while displaying an image. What makes the new augmented reality unique is that digital information is fluid, protean, infinitely customizable and transformative. Much like alchemists, modern entrepreneurs invoke a quicksilver digital as they attempt to transmute the dull substance of commerce into glittering profits.

Race is a complicated topic, far too big to be contained in a short essay, but one of the most interesting sections in Sorting Things Out by Bowker and Star concerns the system of racial classification used in Apartheid South Africa.  From 1948 to 1994, every South African was classified as Black, White, Indian, or Coloured, with segregated housing, employment, and legal rights. Apartheid was an institutional system, a technology backed by a racial pseudo-science, for legitimating and perpetuating the exploitation and oppression of a large portion of the South Africa population.  But it was also a system for generating order, and Bowker and Star explain in detail the Kafka-esque nightmare of lives upended by the arbitrary classificatory decisions of petty bureaucrats. To make this absurd system work, the physical bodies of non-white South Africans had to be ‘augmented’ with administrative tests and pass books detailing precisely what race a person belonged to.

Now, contemporary America is not nearly as racist as apartheid South Africa, but race still matters here, whether it’s on the census form, or in the lived experience of people who experience prejudice, police brutality, and shorter life expectancy. What I find interesting is that as America has moved away from the worst excesses of Jim Crow, racism only becomes visible through technology. We know that the NYPD is racist from their own data on Stop and Frisk, which records statistically higher numbers of searches for African Americans and Hispanics and fewer cases of illegal drug or weapon possession.  If you buy the results from the Implicit Association Tests, pretty much everybody has some degree of racist sentiment. Racism as a matter of systemic bias, rather than overt discrimination, is only revealed through the augmented reality of statistics and demographics, which attach data to people.

There are also interesting patterns in how people of difference races and classes use technology, for example the now classic description of MySpace as a ‘digital ghetto’ afflicted by ‘white flight’, or how twice as many African-Americans use cell phones as their primary form of internet access compared to whites.  Race in America is more than skin color; it’s also cultural, in patterns of speech and metaphor. Even bad ideas sound plausible when presented articulately, with clean graphic design and proofreading. I wonder what would happen to political discourse if we removed this embedded bias towards certain authoritative voices by making everybody present their ideas in ERMAHGERD or after nurbling. Making the form of arguments identical (and ridiculous) might help us focus on their contents.

To return to the premise of the Augmented Reality racism, I’d take the opposite tack from Evan. If race is a matter of surface appearances, than an augmentation that erases these surface differences is likely to make us less racist on an individual level. To flip a popular saying, on the internet we’re all dogs.  And while I’m sure there are some Racial Holy War (link warning: extreme racism) types who would enjoy knowing precisely how many ‘mud people’ there are in a three-mile radius so they could feel threatened and hateful all the time, for most people being more aware of the statistical and systemic patterns of racism (link warning: awesome maps) is useful tool to engage forms of social justice we are currently ignorant of. As for humanizing people, maybe it’s holiday misanthropy, but most people are kinda terrible (link warning: internet Nice Guys), and we probably don’t want to know how much they enjoy Here Comes Honey Boo Boo, or their views on gun control, or the contents of their fridge. Apathy is the lubricant of urban living.

Evan opened with a story about his very Jewish grandmother, and so I’d like conclude with a story about my equally Jewish great-Grandmother, who had very poor eyesight and only got her first pair of glasses late in life. Right after getting her new glasses, she went for her usual walk around the neighborhood with her daughter, and began to sob.
“Ma, why are you crying?” My grandmother (then a young woman) asked her mother.
“Everybody looks so sad,” The old lady said, “Before I could see, I thought they were smiling all the time.”