Mice Eating Watermelon!

DSCN3013

DSCN3014

Sammy and Sam Sam eating watermelon. Engineer bloggers are allowed to be off topic if it’s Sunday and if it’s cute.

Posted in Uncategorized | Tagged , , | Leave a comment

grisbug instamorph

On Friday morning the bathroom sink plugged up and while looking in the cabinet underneath for the snake, I spied a siphon clip that I had made with instamorph. How fortuitous! I had completely forgotten — Instamorph, of course! Just what I needed for making the grisbug enclosure. (Well, perhaps.)

In case you’re not familiar with this stuff, it’s a plastic-like material that melts at 140 degrees F, can be molded into a desired shape, then hardens as it cools. And I thought it would make an excellent enclosure for grisbug, since being formed by hand it tends to end up in organic-looking shapes anyway.

I carefully weighed out an ounce (about $1 in bulk price), heated up a sauce pan of water, poured in the instamorph pellets for warming, and molded a mock-up like so:

grisbug instamorph

I’ve laid out all the components here to show that there’s more than enough room inside to accommodate them. Indeed, I might be able to squeeze in a mini breadboard. I also have a free pin on the ATTiny, so that I could add another LED for internal color.

Posted in Uncategorized | Tagged , , | Leave a comment

Grisbug: first concept

grisbug2

I’m sure everyone is familiar with hexbugs, which are selling for about $6. Well, I’m working on a design for a ‘grisbug’ which will aim for roughly the same price point but have expanded capabilities.

I priced the ATTiny at $1 (in bulk), the 2 LEDs at $.30, the two photocells at $.64, and the motor at $2.50, for a total of (check my math) $4.44. After checking Ebay, I found that button vibration motors are going for $1, which would bring the price down below $3.

Of course we’re assuming a kit, and that the casing cost is negligible. But it looks like I can match the price point of a hexbot — and make something that lights up and is programmable.

As you might guess from the dual photocells, grisbug would be programmable by holding it up to a computer screen and flashing commands. As to what to program, I was thinking that the user could program things like the light level at which the eyes blink on, then also the light level at which the motor runs. And maybe the motor could be programmed to beat out a tune, too!

In another mode, it might be possible to program the bug so that if light levels change abruptly, it reacts by flashing its eyes in warning, then buzzing. This might form the basis of a game in which the user tries to snatch an object away from the bug without moving too fast or too slow while a randomized time limit ticks down.

Well, at this point, I’m not even sure that an ATTiny will accept screen-flash programs. But if so, then grisbug could be an entry level product for young roboteers, with grisbot as its older brother.

Posted in Uncategorized | Tagged , | Leave a comment

ATTiny Photocell/PWM demo

I wrote a little program and made a circuit for the ATTiny which enables a photocell to control an LED and a motor with pulse width modulation.

Here’s the video:


And here’s the circuit diagram:

photo pwm

And here’s the code for the Arduino IDE:

int val = 0;
int qval = 0;

void setup(){
  pinMode(1,OUTPUT);
  digitalWrite(1,LOW);
  
  pinMode(0,OUTPUT);
  digitalWrite(0,LOW);  
}

void loop(){
  val = analogRead(1);
  qval = int(val/4);
  if (val<200){
    qval = 0;
  }
  analogWrite(1,qval);
  analogWrite(0,qval);
}

The LED doesn’t seem to ‘fade’ on. Rather, it seems to come on suddenly.

Posted in Uncategorized | Tagged , , , , | Leave a comment

ATTiny 45/85 Pin Conventions for Arduino IDE Sketches

The main source for information on how to program the ATTiny using the Arduino IDE is found at the MIT High-Low Tech site. But I found the information on the pinouts rather opaque for the newbie (= me), so as an aid to myself I made the following chart for the ATTiny 45 and 85 (which are the eight-pin versions):

attiny pinouts

Inside the above chip illustrations are the physical pin numbers, running counter clockwise 1 through 8 starting from the little circle which appears on the chip casing. You would use these numbers as reference for physically connecting the ATTiny to a circuit, but they are irrelevant to the Arduino IDE.

As for detailed information on how the various pin functions work, I recommend visiting the Arduino Language Reference page. But here I’ll summarize some of the peculiarities of the ATTiny regarding the usage of said functions.

Unlike the ATMega328 chip, the ATTiny needs only one pin connected to the voltage source and only one pin to ground. The reset pin will restart your program when it is connected to ground and then released. The reset pin can also be reprogrammed as an IO pin, but that’s outside the scope of this discussion.

In Adruino IDE software, the ATTiny pins can do double duty as either analog or digital. As you can see, they have different numbering conventions depending on whether you are using analog or digital functions. This is confusing but it does allow for flexibility.

To use a pin as an analog input, you simply use the analogRead() function, referencing the respective analog pin number.

To use a pin in digital mode, you must first use the pinMode() function, referencing the digital pin number and specifying whether you want to use INPUT or OUTPUT mode. Then you can use the other digital pin functions.

(As you may have noticed, you didn’t need to specify pinMode() when using analogRead(). When a pin can be used as either analog or digital, analog is the default.)

You may wonder why analogWrite() is down on the lower table with the digital pin functions. It’s because analogWrite() isn’t really an analog pin function, instead it’s used for pulse width modulation of the digital output signal. Thus you use it with the digital pin numbering convention. As the tilde mark (the ‘~’) indicates, only the two pins in the lower right are PWM capable. As it happens, these pins don’t have an analogRead() capability. Perhaps some sort of internal circuitry tradeoff is involved with that. Interesting.

I’m new to the ATTiny, so I wouldn’t be surprised if there are errors. Corrections are appreciated and the chart will be updated accordingly. I realize that there is stuff that I’m omitting, like what is SCK or MISO or MOSI, but I figure I have to start somewhere.


(NOTE: The ATTiny45/85 chip prices offered on Amazon are reasonable if you’re in a hurry or just want one or two. Otherwise it’s recommended that you shop around.)

ATMEL – ATTINY45-20PU – IC, 8BIT MCU, AVR Tiny, 20MHZ, 8-PDIP

ATMEL – ATTINY85-20PU – IC, 8BIT MCU, AVR Tiny, 20MHZ, 8-PDIP

Posted in Uncategorized | Tagged , , , , | 4 Comments

Thirty Year Old Predictions

new technology book

From the cover:

“Robotics. Today, they build Fords and Toyotas; tomorrow they’ll vacuum your floors.”

“Cable TV. Soon your set will bring hundreds of channels into your home. And you’ll talk back!”

“Computers. Football or horse racing, politics or Wall Street, your portable home computer will give you the edge.”

“Newspapers. They’ll be as obsolete as the horse and buggy, when your hand-held ‘newsfax’ machine brings you up-to-the-minute news and in-depth reports.”

“Telephones. AT&T is just a step away from plugging you into a vast space-age communications network.”

“Satellites. Satellite-supplied weather information will soon be almost 100% reliable — anywhere, anytime.”

“Lasers. Precise enough to focus on a single human cell, powerful enough to blow fist-sized holes in battlefield tanks.”

“Radiation. From microwave ovens to electric blankets, it’s everywhere — and we’re all in a game of radiation-roulette.”

I could make a thousand comments here, but it’s time to get back to work. All I will say is, that thirty years sure went fast, and I suppose the next thirty will go faster still.

Posted in Uncategorized | Tagged , , | Leave a comment

Palpatine Pez Project (Incomplete)

palpy pez

This was an idea I had for Adafruit’s Six Second Video Challenge. I wanted to ‘upgrade’ a Pez dispenser to flash eyes and play music. Given how creepy red glowing eyes are, what better choice than an Emperor Palpatine Pez dispenser?

So imagine that you use such a modified dispenser. What could possibly go wrong? Well, here’s the prototype in action:

Unfortunately, the Adafruit contest doesn’t allow licensed products and yes, I know, hard to believe, Emperor Palpatine is a licensed product.

Thus having gotten around to reading the contest instructions midway through the project, I decided not to go to the additional effort of making an enclosure with hinge switch, using hearing aid batteries instead of AA batteries, and so on. And of course, there are improvements that could have been made as well, for example having the motor vibrate with a pulse width modulation signal to provide true notes rather than just beats.

The microcontroller in question is an ATTINY45V. Here is the schematic:

palpy pez schematic

Electronic candy dispensers are the future and the Pez company should contact me as a consultant. As it turns out, I have free time just now.

Posted in Uncategorized | Tagged , , | Leave a comment

Grisbot Design Studies

side by side

Would grisbot look nicer if the battery was enclosed? I was hoping that I could cut down on the acrylic, but it doesn’t look that way.

Posted in Uncategorized | Tagged , , | Leave a comment

Grisbot ‘light above’ demo

light_above_screen

In the ‘light above’ mode, when a flashlight is brought close enough to exceed user-specified light intensity (a), the robot will turn in place. When the flashlight is brought close enough to exceed user-specified light intensity (b), the robot will move forward in whatever direction it is pointing. Withdrawing the flashlight beam will cause the robot to stop and wait for new commands.

The upward-aimed photocell is plugged into the ATMega328’s analog input corresponding to A2 on the Arduino. I previously made a photocell ‘assembly‘ consisting of a photocell, resistor, and branching lead. However, when I tested it out, I discovered that the shadows of the servo leads would fall on the photocell and cause the robot to move in fits!

Here’s how the installed photocell assembly looked at that time:

DSCN2770

To preclude shadowing, I needed to elevate the photocell above the servo wires. Hence, I did some solder surgery to lengthen the photocell assembly leads, like so:

DSCN2771

With lengthened leads on the photocell assembly, the robot looks like this now:

DSCN2772

And so without further ado, this is how the ‘light above’ mode works:

Posted in Uncategorized | Tagged , , , | Leave a comment

Book Review: Camelot 30K

51NgNGjjVpL._SY300_

Camelot 30K, by Robert L. Forward.

Camelot 30K is a fascinating novel about a truly alien society of shrimp-like intelligent beings who live on an ice world far beyond the orbit of Pluto. If you like hard science fiction, you’ll appreciate Forward’s meticulous technical detail. If you like stories that take place in exotic settings, this outdoes Avatar.

This book may not be appropriate for children, as it discusses social taboos at length. Some might consider age fourteen to still be too young, but by that age your younglings (Lucas’s word, not mine) have probably seen much more already on the internet. However, unlike the internet, this book treats cultural issues philosophically rather than gratuitously. So actually, this might be a good book to give an older child.

Forward is often criticized for lack of characterization, but I really came to empathize with Merlene, his Wizard of Camalor, as a real person with identifiable emotions and motivations.

The plot was entirely believable — though if I were to explain it here in 25 words or less, you probably would be incredulous. But isn’t the mark of a good plot that it is simultaneously unpredictable and inevitable?

(Warning: Do not read the Kirkus Review on the Amazon page until after you’ve read the novel, as the mark of a bad book review is that it contains a spoiler.)

I like stories that lift the reader out of the mundane world and put you in a totally new world with its own rules and logic, where every sight and sound is different. If you’re looking for a blockbuster-movie-like Super Hero vs. Super Villain grudge match that takes place a few hundred feet above an American city, then you probably will find this book boring. If you find that grudge matches above American cities are coming to be a bit tedious and are looking for original sagas upon bizarre new worlds, then you might want to give this book a try.

It’s the most fun you’ll find below the freezing point of nitrogen, and if you truly are the nerd you claim to be then you know that’s high praise indeed.

Posted in Uncategorized | Tagged , , | Leave a comment