|
|
serial Slave Sunday, December 30 2012
After Sunday morning coffee, I walked down through the latest snow to the greenhouse downstairs, where yesterday I'd placed a bag of frozen potting soil. It's always above freezing in the greenhouse downstairs, so the soil had eventually thawed. I used it to fill two steel catfood cans that I then sowed with two different varieties of tomato seeds and placed in a south-facing window in the dining room. The tomato varieties are the Cosmonaut Volkov and the Oxheart. This was the earliest I'd ever started seeds; last year I'd had the experience of watching tomatoes started in January dying off well before the end of the growing season, so this year I will be starting another batch of tomatoes later in the winter.
Gretchen was going to pick up Dutchess (aka "Marigold") from the Ulster County SPCA for another round of fostering, but before that could happen I had shovel out the driveway yet again. Conditions were very cold and the snow was light, powdery, and easy to remove, though it tended to blow around, especially from the tops of piles. For this reason I mostly shoveled it downwind.
This afternoon at around four, after Gretchen had picked up Marigold, we interviewed a prospective paid house sitter, the second interview in anticipation of our upcoming trip to the Dominican Republic. Normally we rely on friends for this sort of thing, but none were available. Our first interview had been of a woman who claimed to be both a vocalist for a heavy metal band and also, get this, a throat singer. That was kind of cool (though Gretchen doesn't approve of throat singing), but she hadn't actually seemed to like dogs. So today we interviewed Zara, a woman Deborah hires to look after Allou. She seemed perfect: she knows how to operate a woodstove and she is even vegan, which means nothing disgusting will get cooked in our kitchen.
While Zara was still here (Gretchen was showing her the local dog walking trails), my infrequently-visiting friend Mark showed up unannounced (as he always does) complete with his enormous Rottweiler puppy named Cheddar (which I kept mistakenly calling "Rev," the name of the Rottweiler he'd had years ago). After briefly hanging out by the fire (where Marigold seemed to enjoy being humped by Cheddar), Mark and I went down to the greenhouse upstairs to smoke what trace amounts of marijuana I could find in the laboratory. Mark hadn't seen the greenhouse upstairs since the summer, when I was still installing the exterior walls. We didn't smoke much of that pot before we saw Zara gingerly picking her way down the steps towards us. It seems Mark's car was blocking her escape. But it was actually worse than that; Mark's car was stuck. He'd tried to give her enough room to escape and had ended up in a snow bank. All of this was solved with a strategically-placed piece of particle board under the front wheel of Mark's car that was spinning (while the other front wheel, which sat on snowless asphalt, did nothing — an engineering design that puzzles me).
After Mark left, I noticed that Cheddar had somehow shed an enormous amount of hair in the greenhouse. I'm not used to dogs that do that.
This evening as I pondered what to do about the problem of communicating with a distant Arduino across an overly-long I2C cable, I came to the conclusion that it would be best to use a serial link instead. The great thing about an I2C bus is its simplicity: multiple devices can be added to it without active hubs. But a serial link (and by this I mean a two-wire 5-volt version of RS-232, not the +/-12 volt version) is also very simple and could theoretically support multiple devices on it so long as I came up with some protocol to send addresses along with commands.
I got the idea for doing this from tinkering with the 28 year old Tandy Model 102. When I'd hooked up wires to its UART, I didn't have to disconnect the wires coming from the voltage shifters ultimately connected to its RS-232 port, which suggested that when that circuitry wasn't engaged (by something hooked up to the RS-232 port), it didn't impose any specific levels on the wires going to the UART. When I was first learning about digital electronics in the early 1980s, I'd learned to call this state "High-Z," and it was important for devices on a microprocessor's data bus to be able to go into that state so as not to interfere with other devices on that bus. Similarly, then, if devices connected to the 5-volt version of an RS-232 bus are going into a High-Z state except when transmitting, I can use one device (a host) to send data containing addresses down the RS-232 cable and then listen as the properly-addressed device responds. This is all theoretical, and I won't know if it works until I try communicating between more than two devices on a shared 5-volt serial link.
But in the meantime, I wrote some code for both the fuel-level-reading slave Arduino and for the other slave Arduino in the Solar Controller (which I us for miscellaneous functions such as controlling the LCD display, reading the infrared signals from a multimedia remote, and handling the details of presenting a menu system allowing me to change Solar Controller behavior without having to use a computer). The new code allowed that second slave (which I'll call the Menu Slave) to serve as a bus master of a serial bus. It will send requests out its serial port (which is only used by the Solar Controller when I am reprogramming the Menu Slave) and listen for responses. The requests will contain simple addressing info as well as a command and perhaps data. For now acceptable commands include:
da - dump user-readable data from the analog pins
dA - dump analog data from the analog pins
dd - dump user-readable data from the digital pins
dD - dump digital data from the digital pins
gd - goad dog, a test of the watchdog system
m - show me how much memory you still have
rb - reboot
sdX,Y - set digital or analog pin X's output state to Y
yt - "You there?" — the response is "Yes I am here."
Now, though, all these commands have to be preceded by the address of the "serial-slave" Arduino in order for it to carry out the command. The fuel level (the only "serial-slave") Arduino has an address of 3, so to make it dump all its analog values in the way easiest for the Menu Slave to parse, I have to send the command '3dA.' Of course, this is all still theoretical; I wrote the code tonight but didn't actually test any of the hardware. Indeed, I still need to install a connector on the Solar Controller's motherboard where I can attach a cable connected to the Menu Slave's serial bus. Since this is all very confusing, here is a diagram:
This evening Gretchen and I watched Trinidad, an interesting documentary about the city in Colorado made famous for its sex change operations. The story is mostly about the male-to-female transgender individuals who decided to stay in Trinidad to support their community. One of them is a former OB-GYN whose familiarity with female anatomy has made her into a much-sought reassignment surgeon (she also passes as a woman, which isn't the case with others who have gone through the process). But all is not perfect in Trinidad or even in its transgender community. There are those townsfolk, of course, who think gender reassignment contradicts the law of God. Others don't have much of an opinion but appreciate all the money sexual reassignment brings to the city. And then there is the inevitable catty infighting between members of the community, which for some reason the documentary chose to include.
For linking purposes this article's URL is: http://asecular.com/blog.php?121230 feedback previous | next |