Archive for the ‘Microcontrollers’ Category

Progress on the cat feeder 101310

I may have decided NOT to hack my servo.  After doing more reading, I’ve learned that when you hack it, you can’t specify how many degrees it turns. You can only change the rate with which it turns and in what direction.  I’m not sure if that will work well. I can imagine getting it to turn very slowly over a 15 minute time period and by adjusting the gears, change how far the dispenser is turned. OR, keeping the ability to specify how many degrees it turns.  I figure the next thing I need to do is get a way to start attaching gears and actually try it out. That, and buy an appliance timer.

So, tonight I used some very sophisticated and high-tech materials and tools to start that process. First, a very important thing I realized I should share with you all: my thinking head band.

Its a sparkly yellow flower!

Ok, then onto the working!  Here is a very sophisticated and high tech material for the grasping part of my turning gizmo.

Check out my precision measuring and marking skillz!

My very sophisticated and high tech precision tools.  I actually love my tin snips – they cut everything! … I wonder if they ever get dull?

I learned two things cutting these notches out: 1) the pvc pipe cutter breaks the plastic all the way to the end and 2) the tin snips work well, but don’t snip it closed at the end – you’ll get a small break.  Here is the notched graspy thingy!

Look! It fits! At first I thought I was going to drill a hole and glue in a shaft to which a gear would be attached, but now I think I’ll just find a big gear and just glue it to the bottom. I’m all about function here…

Actually… I am harboring fantasies of rebuilding the cat feeder when I know it works using brass and aluminum and the Steampunk aesthetic! Yay!


Tonight’s cat feeder progress.

So, I started out the night trying to figure out how to install DateTime into the Arduino library and then into my Teensy.  What this really means is that there’s some special programing that someone else went to the trouble to write which I could concievable use to keep track of time on the Teensy without having to have it hooked up to a computer all the time and then run the program at set times. For my purpose, that would mean that the Teensy would keep track of the time and know to turn on the servo at the times I specify to feed the kitties.

I think I got the library installed alright, but there’s supposed to be a special place to save the example file so I could load it into the Teensy to see if it worked … and I couldn’t figure it out!  I’m still not sure where my “sketch library” is … I have learned that “sketches” are what they call the programs that go into these microcontrollers (like the Teensy) – that took me a few minutes.

While I was looking for where my sketch library is, I saw some people advocated using a separate device called a RTD (real time display) – which really means: a clock – that you wire to your micro controller. Since that was a bit beyond me, I was getting frustrated.

But while I was getting gritty eyed trying to understand all this my brain was working at it from an old angle.  “Are you sure an appliance timer wouldn’t be easier?” it asked.

“Well, yeah it would,” I responded with some asperity, “but I still don’t know how I’d get the servo to turn only once in a 15 minute span of being turned on… even 1 minute is too long!”  Here I imagined to my brain Malley scarfing up a huge mound of food that is pouring from the continually turning dispenser.

And, not in words, but in motions and streams of jibberish programming my brain showed me how to change the angle and delay times in the servo sketch so it only ran once!!  Wow! I love it when my brain works better than I do!  Which means, in the program that someone else already wrote that I used to successfully run the servo off the Teensy, I can change some of the numbers so it turns a certain number of degrees and then waits for a long time before moving back to the original place. “DUDE, brain! That should be easy!”

So, I’ve been playing with the delay times, with not a whole bunch of success, but I’m learning stuff none-the-less. The original sketch says to turn the dohicky 180 degrees and then wait for 15ms before turning it back.  NO, wait! It doesn’t, really!  And I know this because when I changed the delay time to 60000 ms, I thought it wasn’t turning.  What I wanted it to do, was turn 180 degrees and then wait a minute before turning back. But instead, it didn’t turn and was making clicking sounds which my brain, I guess I should say Brain cause it’s so awesome and seemingly separate from my brain, just realized was the servo turning one degree every minute!  I think!!  ??  Wa? Tomorrow I will do more experimenting with the variables…

But now it’s time for bed, so I have to stop… Golly, I make a great team!

So excited!

I just hooked my servo up to my teensy board and loaded a 180 degree sweep program and it worked!  My heart actually started beating hard and fast in excitement!!  Now I have to figure out how to get it to sweep the servo once at prescribed times and then figure out the mechanics of changing this rotating motion to a continuous motion effecting two cat food dispensers…  Fun nights ahead!

Silk painting 092810

I fixed the dyes this evening and they are now drying in preparation for the final ironing before wearing. Or something. Still not sure what to do with them. But it’s interesting how the color intensity decreased a bit upon drying. And I may I have waited too long to use the salt – I noticed very little effect.

My favorite part of my favorite scarf (mostly just cause of the colors) although the interesting pattern from the squirt bottle diffused and is no longer noticeable:


I think the swirls in this one are super awesome!

And here’s a little bit of the salt effect:

PS: Got my servo! If I’m not feeling too icky tomorrow, I may play with it a bit! Woohoo!!

Cat Feeder 091110

I have gotten tired of my cats scratching and meowing at me before I want to wake up to be fed.  I have also seen how powerful frequent, portion controled meals can be in reducing and maintaining weight and would like to try to share that with my cats. Having a job makes it impossible for me to feed my cats 4-6 times daily, though. So, I naturally decided to make an automatic cat feeder.  I looked a several tutorials on instructables and MAKE, but none of them did what I wanted: multiple, small portions delivered indefinitely. This cereal dispenser is the first part towards my feeder. $38.89 (s&h included)

I took the long back parts off because I’m planning on mounting this on a board out of kitty reach.

While the knob clearly has four lobes, the spindle inside the canister is divided into 6 sections. So, when I build the turning mechanism, I’m going to have to get it to turn only 60 degrees, rather than 90. Turning 90 releases two sections of food. Each section releases 1/4 cup of food. If the knob is turned 90 degrees, 1/2 cup will come out.  If my goal is to feed the cats at least 4 times a day and, since they’re on a diet, they get fed 1/2 cup a day, I’ll need to make each section smaller. Preferably releasing 1/8 cup. 1/16 would be even better though!

I have to decide how I’m going to make the sections smaller.  Using cardboard and tape were suggested to me, but you know how tape can curl and leave sticky residue on the things around it. I’d prefer not to muck up the spindle or feed residue to my cats. I’m thinking about using some sort of styrofoam or spray foam, but am not liking that idea – I’d imagine it would be hard to clean and not be good for cats to eat.  I just now thought of using fimo. I can mold it to shape inside the spindle, take it out and bake it and then varnish it in nontoxic varnish.  I’m guessing two-part epoxy would not be “healthy” so I’ll have to come up with a safe glue.

Once I get that figured out, I have the turning mechanism to build which will be attached to a Teensy or Dorkboard which will do the timing and turning on and off of the turning mechanism servo.  The servo is in the mail and should be here soon! Yay!

Microcontrollers: finis

Ok, so where was I?  Reviewing my microcontroller class… I talked about RGB and PWM…

Next we explored output – how to see information from the teensy about what it is doing.  You can choose “serial monitor” which will output information to a screen on your pc if the teensy is hooked to it.  Further in the code, you can specify what type of output the teensy will show.  With the coding “serial.print” and a message, you’ll see the message you identified being printed on the serial monitor.  Changing the program while using other microcontrollers can make this information much more interesting and useful.  For example, attaching a pushbutton, potentiometer, or thermistor will provide new information to the teensy which can be viewed or manipulated on the serial monitor.  So, you can program the chip to read when a button is pushed or not pushed and have it use the serial.print to output certain text in response to each condition.  With an analog microcontroller, you can have the serial.print output analog information to the serial monitor using the analogread function.  Then you can even apply equations to the data to show a new value – you’d have to do this if you want to see temperature as measured in Ferinheight from the thermistor.

Pushbutton:  In the set up we learned in the class, the pushbutton acted as an “active low”, which Paul described as having a “signal [that is ] low when the condition is happening” meaning when you or the environment acts upon the teensy system, the amount of voltage cycling through the system is low or (in my mind) broken.  So, in this case, when you push the button you are breaking the electricity cycle.

I am still a bit confused about the “pull-up” nature of this button in this situation.  Looking at the tutorial, there’s a resistor that we put across the breadboard between the button on the plus side and over to the negative side.  So, I’m thinking that, when you push the button and interrupt the flow of electricity, when you let go of the button sometimes the electricity doesn’t start cycling again.  The resistor is holding a little bit of electricity which gets pulled into the button when you let go, maintaining the cycle.  Kind of like, if you’re siphoning water out of a fish tank and you pull the high end of the tube out of the water all the water in the tube falls down the low end and you have to start the siphoning all over again.  The resistor is sort of like your thumb over the end?  Maybe?  Not really, because it isn’t working to stop the flow or maintain the pressure in the tube, but kind of like that. That’s not an ideal analogy for that, but it works for my brain!

Potentiometer: This is a resistor that lets you change how much voltage gets let through.  It’s considered analog because you can have increments rather than just “on/off”.  In our tutorial, we used it to change the bulb color from green to red and back. Using the programming, the board sensed how much voltage was being let through from the potentiometer and then it changed the amount of color in response.

Temperature Sensor (thermistor): this is really simple to install. It’s a resistor that changes how much voltage can pass through it depending on the ambient temperature.  Therefore, the teensy can measure the voltage as an analog input and then use the analogread to show how much voltage is passing through.  This number doesn’t make much sense to us, though, because we use the farenheight or Celsius scales most commonly, so add some equations to convert into the familiar scales.  Wa-la! Super easy!!

MICROCONTROLLERS: my introduction 100509

I have been wanting to build lots of things: an automated cat feeder, a watering system, a computer-turn-er-on-er, and various art stuff.  These things all require some knowledge of microcontrollers.  Which I don’t have. So, I’ve been paying attention to a local group, Open Tech Space, and saw that they were having two workshops: microswitches and the Arduino Cult Induction.   Both being hosted by my darling, Portland TechShop (great deals on memberships right now!!).    ** Disclaimer! All my “nube knowledge” is what I learned, as it filtered through my brain which is heavily influenced by my education in speech language pathology – I can tell you the spectrograph characteristics of most of the phonemes of the english language – which is a little skewed from your normal technogeek nomenclature.  So, what I’m getting at is: I could be wrong!!

I took the microcontroller class on the 5th, taught primarily by Paul Stoffregen, using his “Teensy” microcontroller – a very cute little thing.  The first thing I learned was that there are lots of different microcontrollers out there!  – See how nube I am? –  Each has different strengths and weaknesses, so you pick depending on your project.  For example, someone told me you can get a Teensy with WiFi already on it! Very cool!  So, in this class we plugged our little Teensy into a breadboard (nube knowledge: a breadboard is a place to easily plug your chips and accessories in without soldering, so you can pull them out and rearrange them easily until they work) and attached many microswitches.  We used several microswitches in this class:


The first thing we put in was an RGB LED.  We first wrote code (in C – something I’ve NEVER done before!) to make the light flash red.  Then we started getting trixy by making it flick from red to green to blue, and THEN we started having it slowly transition by increments from red to green!  Finally we worked to make different colors like purple and yellow – all by changing the intensity and frequency of the variables! Very fun!  When we put in the LED we chose three pins with the “PWM” feature (nube knowledge: PWM stands for “Pulse Width Modulation” and refers to that part of the chip being able to control the duration and frequency of the electrical signal to the device. This is how you can carefully control the amount of light being emitted to change its colors).  We began to explore output as well, using “Digital Output” (nube knowledge: “digital” most of the time means on/off, or yes/no, or as in this case high/low – so when when it says “high” a relatively larger amount of current is allowed through the bulb, when it says “low” only a little bit of current is allowed. I think.) and “Analog (PWM) Output” (nube knowledge: “analog” in this case refers to the fact that you can have a variety of values, not just two. So we actually use numbers between 0 and 255 (I’m not sure why) to refer to more variable levels of current through the bulb where 0 = “low” and 255 = “high”, but now we can represent any amount of intensity between them.)

Ok, I have to stop for now, but will pick this up again soon and cover the other microswitches we learned about – this is a really great way for me to remember what I learned.  Overall, this was an awesome class! Paul was a great instructor: clear instructions, good pacing for the nubbies, nice overhead projector support and an EXCELLENT written handout that I was able to follow several times on my own.