Flip Clock Mod


After getting the Arduino LCD shield code running again, I wanted to come up with some kind of a mod to the Gakken Flip Clock. Most of the obvious ones have already been done – drawing animations on the clock number sheets (you can buy blank punch out sheets without the numbers from Gakken for about $5 per set), robotizing the clock, putting it into a new case, or connecting it to some kind of smartphone app. But, something that I’ve been noticing with the last couple Gakken kits is that they haven’t been doing as much for connecting up the Japanino.

Since I just bought my replacement Japanino and I had the LCD shield code working, the idea for drawing the flip animation on the LCD and then controlling that with the clock was an easy leap. I just had to find some time to sit down with a soldering iron, and to figure out how to encode the graphics.

For the graphics, the limitations are that the Japanino only has 1K of variable space and 16K of program memory. Couple this with the fact that the LCD shield is 128 pixels by 128 pixels and doesn’t have buffer memory, you see the image updating as it’s being drawn. I decided to keep the drawings small – 64 x 64 pixels, to keep the visible updating to a minimum, and to use 8-color run length encoding (RLE) to keep the code simple. I took the existing Sparkfun library and converted the setChar() method to draw my picture instead of text fonts. I used GIMP to make each animation frame (2 frames per cycle), saved them as .bmps, and wrote a short perl script to convert the .bmp binary to ASCII text. Because I know VBscript better than perl, I wrote a .vbs file to convert the ASCII .bmp into a C++ char array to be copy-pasted into the .h file for the modified setChar() header.  I didn’t bother trying to make pretty pictures – that can come later. Right now, I’m just trying to prove the concept. But with SLEEPING, DRIVING, EATING, WORKING, TOILET and PUZZLED, I have six 2-frame cycles and the program size is about 10K. That gives me room to either make more detailed pictures, add more colors, add more frames, or add more activities.

On the hardware side, I soldered in 2 wires to the motors (to the black and blue contacts), and spliced in a ground wire running from the battery holders. Earlier, I put in an on/off switch to the red wire from the battery pack and hand-drilled a mounting hole for the switch at the back of the case. I just ran the three new wires out the hole used for the minutes leaf switch and routed them to the back of the housing. I then soldered the two motor wires to an Arduino through-header, and connected a straight pin to the ground wire. Minutes goes to A0, Hours to A1, and black to one of the GND pins. analogRead() returns near-zero when the motor is off, and between 500 and 750 when it’s pulsed (it’s a dirty pulse, probably because the battery is being pulled down when both motors are running.) So, I just do an inline-if to get a “0” value if the analogRead() is below 300, and a “1” if it’s above.

To advance the minutes and hours numbers, the motors are pulsed once per increment, and the pulse cycles are about 100 ms long. When the batteries are fully charged, the clock will automatically reset to “00:00” on power-on. I have a short delay timer that suppresses the motor pulse counter until after the reset is done. However, if the batteries are getting weak, there’s no reset and the clock time will be wrong, so my reset delay timer gets overridden if there’s no reset in the first minute. After the reset delay, any motor pulses will increment my minutes and hours variables. Finally, I flip through the animation cycles 2 frames per second, and the actions portrayed in the animations are determined by an if-statement with time = minutesCnt + hoursLookUp[hoursCnt] * 60.

Lastly, a comment about hoursLookUp[]. In order to keep the number of holes the same in the minutes and hours drums, the hours numbers are duplicated, and the clock controller sends multiple pulses depending on the time. There are 2 flip cards for 00 to 12 hours (1 pulse every 30 minutes), and 3 flip cards for 13 to 23 (1 pulse every 20 minutes). To simplify things, I just put the hours values in a 60-element array, and get the actual hour based on the number of motor pulses detected. I could speed the code up a little more by doing the “* 60” part within the array elements as a static constant. (I’ll do that when I have time.)

But, the idea works, and I can use the same approach to turn the LCD shield into a simple photo frame. I may even add .gif support to the library. Some day.

(Sidenote: There’s been no real news from Gakken lately, beyond a couple announcements of the Open Reel Ensemble’s concert and subsequent DVD going on sale back in May. Amazon.jp currently has a July 25th release date for the next Gakken kit, the updated pinhole planetarium.

Last week, the subject for the famous people series magazine was Tolstoy; the character design looked like a Kewpie doll with white cotton glued on for a beard. This week is Glen Miller, and I don’t know what that design is supposed to look like. Next week is Kenyan activist Wangari Maathai, who I’m not really interested in. I’m waiting for Howard Carter, the week after.)

Advertisements

Going back to the Japanino


Back after the big 2011 earthquake in northern Japan, because of the resulting threat of radiation from the Fukushima reactor meltdown, I had to move out of my Tokyo apartment. I was limited on space in the new place so I gave up a number of the Gakken kits I’d built, including the Japanino micro-controller. Recently, I’ve been wanting to do more electronics work, and I finally broke down and bought a second Japanino kit from a bookstore in Kagoshima. Then I ordered some parts from Sparkfun in the U.S. – a new MIDI shield and a replacement LCD shield.

I’d used the LCD shield for a number of graphics projects before, so the first step was to confirm that those performed the same way on my new notebook computer with the same setup as before. Of course, nothing is ever that simple. The Arduino IDE had changed in the 2.5 years since I last used it, so that required learning the new menu system. But the real pain in the butt was that Sparkfun had changed the LCD shield C++ code into a class-based library. They’d ripped out the support for different font sizes, made the primitive lcdData() function private (meaning that there’s no way for easily using the LCD’s built-in scroll option) and made a few other tweaks that apparently introduced bugs into the code.

My Edo-era Clock emulator suddenly had the graphics jump several pixels down and to the right, and the characters that made up 2-part Japanese figures (the display of the Japanese symbols for “9” and “6” requires using two alphabetic characters side-by-side) suddenly became reversed. Because I used 2 font sizes, large for the analog clock and medium for the digital display, I had to add the font support back in and that demonstrated that Sparkfun had changed the font tables somewhere. Long story short, porting my old sketches to the new library was something of a nightmare.

Of course, there was at least one item that was buggy in the original shield support code that wasn’t fixed in the new library – the pre-defined names for colors are reversed from what’s actually displayed when you use them with text strings. Using YELLOW with setLine() displays a yellow line, but with setStr() the text comes out as cyan. Using CYAN makes the text come out as yellow. There are two possible drivers for the LCD itself, Epson and Philips. I have the shield with the Philips driver, and there are two lines of code in the library that make a macro call to swap(). Commenting them out causes the bug to go away. swap() is only used for the Philips driver, so maybe Sparkfun has the Epson driver and never did full testing of the library on the Philips LCD.

Anyway. After messing with the LCD shield code off and on for about a week, I’ve got it working with my original Edo-era clock emulator. Took long enough. Now I can try tackling something new with it.

80 Famous People – Hokusai Katsushika


Back in the 80’s, there was a really nice little independent bookstore in the same shopping center as my favorite tex-mex restaurant. The restaurant was tied into the building’s PA system, so you could place your reservation and then walk around for an hour. When your table opened up, you’d hear the announcement no matter where you were. I’d go there every Friday night, and then spend the hour in the bookstore. They had a good selection of artbooks, including several coffee table books on Ukiyo-e. I bought one collection of Hiroshige‘s prints, and I was considering getting some others. Sadly, the entire complex closed up before I came to Japan the first time. However, as part of my first trip here, I worked for Hitachi in Yamaguchi prefecture, and during one day trip to Yamaguchi City, I happened past a used art print shop that had a box of ukiyo-e out on a table in front. I ended up buying several prints as gifts for $60, including Hokusai’s Great Wave Off Kanagawa. Later, when I was working on my History of Manga webpage, I picked up a copy of Hokusai Manga, vol. 1 from the Manga Museum in Harajuku. So, yeah, I know a little about Hokusai. Not that much, though.

I was debating whether to pick up this volume of the mook, because the character designs are modern-day manga style, and not at all in keeping with Hokusai’s self-portraits. However, the textbook section had some nice reproductions, and I figured, “what the heck”. Up until this point, I hadn’t seen that much personal information about the artist, so this mook is useful on that count. According to the wiki entry, he was born sometime around 1760, and died at 90 in 1849. His early years are up for debate, but he learned to paint at about age 6, was sent to work at a lending library and bookshop at age 12, and became an apprentice woodblock carver at 14. By 18 he entered the studio of Katsukawa Shunsho and he learned how to make ukiyo-e there. Ukiyo-e is a woodblock (“hanga”) printing system where different blocks are used for each color of ink. Initially only in black-and-white, it had become a full-color process by the time Hokusai was a child. It lends itself well to a factory-style assembly line, where the artist makes the rough draft drawing, someone else stencils it on the blocks, a third carves each block, and a fourth operates the actual printing press. It gets its name from the lower caste levels of society which treated the living world as impermanent or “floating” (“ukiyo-e” = “pictures of the floating world”) , and generally consisted of images of kabuki actors, geisha, folktales and landscapes. The term manga was first coined to refer to woodblock prints that were outside the typical ukiyo-e genres.  Hokusai’s skills surpassed simple landscapes and caricatures, and his volumes of “manga” contain thousands of drawings of workers, craftsmen, animals, mythical beasts and facial types.

(All rights belong to their owners. Images used here for review purposes only.)

In the textbook section, the mook discusses various aspects of Hokusai’s life. He took on over 30 pennames, to represent the different changes in his art styles. He moved 93 times, including a reported 3 moves in 1 day. While he traveled Japan extensively to do research and for his “36 Views of Mt. Fuji” series, he and his daughter, Oei, hated doing housework. When one apartment became too filthy to stand any further, they’d move out. Oei was also an accomplished artist, as well as a model for some of Hokusai’s drawings. Neither of them could be bothered to worry about money, so while their prints sold well, they’d occasionally find themselves broke. In 1839, his house and studio were destroyed in a fire; he supposedly worried only about saving his brushes. According to the wiki, his final words are translated as, “If only Heaven will give me just another ten years… Just another five more years, then I could become a real painter.”

In the intro manga, Youichi and Mami’s mother is getting ready for a visit from a foreign penpal. The kids suggest that she prepare a fancy dinner for the guest, but Merrino berates them because foreigners really want to see what Japan is like (that and he’s trying to get Mrs. Makiba to make more cookies for him to eat). The group agrees. That night, Mohea has a room made that combines a Japanese bath, with a painting of Fuji on the tile wall, with a living room that has anime playing on the TV. In the bath is a big fish. As the rest of the group talk to her, the fish stands up – turns out that the foreigner is actually a space traveler named Salmon Marineski, from Fish Planet. Everyone changes into swimsuits and jumps into the bath. In the wrap-up, Salmon is happy to learn about Japan, ukiyo-e and Hokusai, and he thanks everyone for making his trip so enjoyable. In the last panel, he picks up a slice of sake sashimi (sliced raw salmon), says it looks delicious and asks what it is as he prepares to take a bite. Mami stands by in shock.

The main manga is by Noboru Rokuda this time (Saigo Test, F, Dash Kappei, Ganso). The incidental characters are often portrayed in the traditional ukiyo-e styles (long thin head, crescent moon eyes), while Hokusai and Oei are more blocky and manga-like. There are a few reproductions of Hokusai’s drawings, and the backgrounds are pretty detailed. The art’s good, but I’d have preferred designs closer to Hokusai’s self-portraits. What really stands out, though, is the storytelling gimmick. Essentially, Rokuda introduces himself into the manga as an unseen reporter that acts in first-person. The narration is actually Rokuda talking as he walks through Edo (old Tokyo) and interviews people.

The story starts out with Rokuda visiting a young Hokusai in 1794, and tries to talk to him under the name Tetsuzo. He offers to buy the artist a rice cake and sake, so Hokusai slams the sake down and quickly passes out. Hokusei normally doesn’t drink because it affects his ability to draw and thus he can’t handle his alcohol. He asks if Rokuda knows about kintaro ame, which is a kind of hard candy with an image of a boy inside that is stretched out. While the image looks the same in cross-section no matter where you break it, there are actual differences if you look close enough – angry Kintaro, smiling Kintaro, sad Kitaro, etc. Hokusai then stalks off to play with one of his daughters from one of his wives (married twice, with 4 sons and 2 daughters). Rokuda asks if the reason he’s so busy is because he has so many mouths to feed and Hokusai throws a bottle at him.  Time passes, Hokusai changes names, publishes a variety of drawings, and grows in popularity.

In 1817, Rokuda finds the apartment empty and assumes that Hokusai has moved again. Wandering through the city, he locates the artist in front of a temple completing a brush painting of Daruma on a canvas 120 square tatami mats (600 feet long). Oei is walking through the crowd, throwing out handfuls of rice. On closer inspection, each kernel is seen to be painted with 2 small sparrows. Hokusai then goes on a trip for his 36 views of Fuji, and Rokuda now understands the reference to the kintaro candy – each aspect of Fuji yields a different kind of landscape. This is when he creates the Great Wave. In 1849, Rokuda interviews Oei, while her father lies passed out on the floor, a brush in one hand. Her father leaps up, demands that the gods give him 10 more years so he can become a real artist, or at least 5. Oei asks about his latest painting and he says its the soul leaving the body and traveling over a summer plain. He then collapses and dies soon after at age 90. Rokuda claims that he can actually see Hokusai’s soul over a field, and thanks the painter for all his hard work.

The textbook section describes Hokusai’s rumored early childhood, education as an artist, and professional background. Sidebars talk about his filthy living quarters, why he moved so many times, his occasional poverty, and many pennames. There’s a small discussion of Oei, and various representative reproductions of his works. The last 2 pages talk about how ukiyo-e prints made their way to Europe via a French importer named Felix Bracquemond as packing material for ceramic vases, and then grew in popularity with artists like van Gogh, Gauguin and Cezanne. There’s a mention of Hiroshige, and an explanation of the woodblock process. The final sidebar explores the mystery of Toushuusai Sharaku, an immensely popular ukiyo-e artist who came out from nowhere, released over 140 prints and then disappeared again. One speculation is that he’s one of Hokusai’s many pseudonyms, but there’s been no confirmation of his identity one way of the other.

Overall, I did learn a lot that I hadn’t known about Hokusai before, along with some details missing from the English wiki. The mook manga is just a brief introduction to the artist as a person and doesn’t get into any significant detail, but it is a nice start. Recommended if you can find a copy and can read Japanese.

80 Famous People – Vincent van Gogh



(All rights belong to their owners. Images used here for review purposes only.)

Vincent van Gogh is well-known as an impressionist painter, as well as “that guy that cut off his ear to give to a girlfriend”. Born in Zundert, Netherlands, in 1853, he moved around a lot as an adult, working as a missionary in Belgium, a teacher in England and then as an artist in Paris and parts of southern France. He had a close relationship with his brother, Theo, and attempted to establish friendships with other impressionist painters in Paris. However, his mental illnesses made him emotionally unstable, while probably also driving his artistic senses. He’s reported to have frequented various brothels, and it’s possible that part of the problem was derived from having contracted syphilis. He’d gotten into arguments with Gauguin over art, and at one point attacked the other artist with a razor blade. He then retreated to one of the brothels on Rue du Bout d’Aeles, and used the razor to cut off pieces of his left ear, which he then gave to a prostitute to protect. He later checked himself into an asylum, Saint-Remy, near Arles, for about a year. Reportedly, his mental condition worsened and he’s believed to have shot himself in the chest with a pistol, although the gun was never found. Two doctors attempted to care for him, but they weren’t qualified to do the surgery needed to remove the bullet. Theo was contacted and he rushed to see Vincent. At the time, van Gogh was in good spirits, but infection from the untreated wound kicked in a few hours later, and he died about 29 hours after pulling the trigger.

Theo set up a gallery to display and sell Vincent’s works, but there was only 1 sale while he was alive. A few months later, Theo died from the effects of syphilis. Theo’s widow, Johanna, published Vincent’s collected letters, and that eventually raised awareness of van Gogh as an artist and his popularity increased from that point. Later, both brothers’ remains were exhumed and relocated to be next to each other in Auvers-sur-Oise.

The intro manga has Youichi and Daichi looking at a poorly-drawn flier advertising an upcoming school dodgeball game. Youichi wants to win this time, but first he’s compelled to do something about the flier. He notices that Utako is wearing a pin with sunflowers, and she states that it’s a souvenir from her father’s business trip to France, inspired by van Gogh’s paintings. Youichi decides to use the yellow pull tabs from small bottles of milk to create a sunflower-like banner for his supporters to wave during the game. Unfortunately, he can’t drink enough milk to get the number of tabs he needs and he falls into despair. Then, Daichi and Merrino step in with the tabs they’d collected, but it’s Utako who’s smart enough to get a kindergarten class to help out in drinking all the milk. This gives Youichi way too many tabs, and the finished flag weighs several pounds. In the wrap-up, Youichi has made it to the final dodgeball round and it’s just him and one opponent in the last match. Youichi had injured his finger along the way, and he’s afraid he’s going to lose. Suddenly, he sees a yellow petal fluttering by – Mami and Merrino are waving the flag so hard that the tabs are falling off. The resulting image is like van Gogh’s sunflowers. Thus inspired, he manages to eliminate his opponent and win the tournament. The story ends with a janitor forcing the gang to pick up all the loose tabs from the floor of the gym.

Kazuasa Sumita (Flower Claw, Kamigariki, Witchblade) is the featured artist on the main manga. He’s done a very good job at capturing both Vincent’s likeness, and the spirit of his paintings. This volume is one of the most realistically-presented manga in the series so far. But, the story itself is simplified and reworked to appeal to a younger audience. There’s no mention of the brothels or sexually-related diseases, and Vincent is not shown attacking Gauguin with a knife. Instead, the focus is on Vincent and Theo’s brotherly bonds, and the paintings created at certain time points.

The story starts with Theo entering Vincent’s room in the “yellow house” in Arles, as his older brother lies in bed, dying. There’s a close-up of a pistol, implying that it’s in the room with them. Vincent says that he can’t take this world’s pain anymore, and he dies as Theo shouts out his name. There’s a flashbask to when the two were boys, and Vincent had been punished by his father. He feels alone in the world, and Theo promises to protect him. The scene shifts to when they were both young men and Vincent has failed to hold down another job. Theo is trying to understand Vincent’s artistic path, and gets yelled at for not getting what Vincent sees. Vincent goes outside to paint some landscapes, and finally produces “The Potato Eaters”. He sees some impressionist works at a museum and falls in with artists like Emile Bernard, Louis Anquetin, and Henri de Toulouse-Lautrec. He meets Gauguin and, moves into the Yellow House in Arles. But, Gauguin berates him for not understanding what an artist’s true function is and tells him to stop painting. In despair, van Gogh cuts off part of his ear and then checks into Saint-Remy. This is followed by a change in his artstyle and the production of “Starry Night”. He continues to exchange letters with Theo, and as a show of support, Johanna suggests that they name their new baby “Vincent”. van Gogh then moves in with his brother, but he hears Johanna arguing with her husband over the additional burden on their finances, since Theo is unable to sell any of his brother’s works. He finishes “Crows Flying over a Wheat Field”, and then supposedly shoots himself to stop causing problems for Theo. The scene returns back to Vincent’s death bed, and the story ends with Vincent praying that Theo could see the beautiful world of nature that he sees.


(From the last 2 pages of the textbook section.)

The textbook section describes Vincent’s upbringing and time spent wandering around western Europe and England before settling down in France. There is some discussion of his interactions with other impressionist painters, and the argument and fight with Gauguin. There are sidebars on Theo and Johanna, and photos of many of his paintings. Ukiyo-e, Japanese woodblock prints, were making their way to Europe at this time, and van Gogh avidly collected them. He included several in his later paintings, and “Almond Blossoms” (1890) was heavily influenced by ukiyo-e. The last 2 pages talk about 4 of his paintings and “reveal their secrets”. In one self-portrait, he’s shown as being left-handed, but that’s because he was using a mirror and the image was flipped left-for-right. There are two versions of “Vincent’s Room” (1889), and the big differences between the two are explained as their having been made for two different audiences. And, there’s a comparison of Vincent’s “Sun and Sower” (1888) with Millet’s “The Sower” (1850). The magazine wraps up with the 2 postcards.

Overall, the artwork is really good in this issue, but the story contains several obvious omissions and alternations. The most glaring are Vincent’s frequenting brothels, giving his ear to a prostitute, and the changing of his last words. Theo reported them as “The sadness will last forever”, while the mook gives it as “I can’t take this world’s pain anymore”. So, if you want to see van Gogh’s paintings, this magazine is recommended. If you want an accurate biography, go to the library.