Friday, August 28, 2009

Urban Agriculture III

Snakey is Strong


It's been a few months, but my tomato plant (Snakey) is growing strong. His brother (Pip) was given to private charity and I can only hope he is doing as well. Snakey gets his name from how he snakes around his pot, which is also giving him support. He has yet to fruit, and I'm skeptical that he ever will. Someone told me you need more then one plant to fruit, but I'm hopeing this isn't so. I also hoping I get some tomoatos soon, otherwise he might get caught by a frost.


Wednesday, August 12, 2009

Blueberry Muffins


Not my recipe, but the best muffins I've made to date. Click the title to see the original recipe.



  • 1 1/2 cups all-purpose flour
  • 3/4 cup white sugar
  • 1/2 teaspoon salt
  • 2 teaspoons baking powder
  • 1/3 cup vegetable oil
  • 1 egg
  • 1/3 cup milk
  • 1 cup fresh blueberries
  • 1/2 cup white sugar
  • 1/3 cup all-purpose flour
  • 1/4 cup butter, cubed
  • 1 1/2 teaspoons ground cinnamo

  • Preheat oven to 400 degrees F (200 degrees C). Grease muffin cups or line with muffin liners.

  • Combine 1 1/2 cups flour, 3/4 cup sugar, salt and baking powder. Place vegetable oil into a 1 cup measuring cup; add the egg and enough milk to fill the cup. Mix this with flour mixture. Fold in blueberries. Fill muffin cups right to the top, and sprinkle with crumb topping mixture

  • To Make Crumb Topping: Mix together 1/2 cup sugar, 1/3 cup flour, 1/4 cup butter, and 1 1/2 teaspoons cinnamon. Mix with fork, and sprinkle over muffins before baking

  • Bake for 20 to 25 minutes in the preheated oven, or until done.

Wednesday, June 3, 2009

Desktop CNC Router I

I'm excited about my new summer project!! I'm working on a desktop CNC router that I plan to design and build from the ground up. I've been reading about DIY CNC projects, so this idea is nothing new, but in the true spirit of DIY, I plan to design and build everything myself (with the exception of motors and ICs and such). This does however include making my own control software, stepper motor drive circuits, frame, etc....

So here's the basic overview. I'm using the motor from an old dremel tool as the router, 3 stepper motors from Anaheim Automation, an ATX power supply from an old computer (~200W), custom built stepper motor chopper drive, serial connection to a windows computer, and a custom computer program to translate a G-Codes into commands for the motor. I'm leaving the CAD to the professionals.

Step one is to build the stepper motor driver. The circuit is essentially a 3-axis chopper drive for 6 or 8 wire unipolar stepper motors. The micro controller (pic18f452) accepts serial input, conditioned through the max232, as control for the motors. In additions, there is a step and direction pin for each motor, where a pulse train can be used to control the motor. To control the chopper drive I'm using 2 mcp4922, which are 12 bit DACs. The DACs set a reference voltage for the comparators for each motor. When the drive transistor for a coil is turned on, a current begins to flow through the coil, transistor and it's series resistor. As the current reaches the motors rating, the voltage across the resistor reaches the set point from the DAC and the comparator trips, telling the micro controller to turn of the transistor. An internal timer in the micro controller periodically turns the power transistors back on. This way the motors can be driven about their rated voltage, without damaging the coils.

The coils for my motors have a resistance of 1.4 Ohm, so I chose 5W, 0.1 Ohm resistors to minimize the power loss in the resistor. I also picked the power MOSFETs to have a low on resistance, and to operate around logic levels. I had to sacrifice a little bit of voltage and current, but they are still rated higher then I expect to use.

The micro controller communicates to the computer through an rs232 interface, which I will elaborate on more in a post about the firmware. This allows the user to set the limiting current for each motor as well as the chopper frequency through software. This will also be how the computer moves the motors. 
I have the circuit constructed on a breadboard, and am currently working on writing and debugging the code for the PIC. I'm doing the entire microchip code in assembly, so hopefully it will be optimized. With the breadboard, I only had enough room to drive one motor, so last weekend I started building the final board for the motor. It would be easier to get a printed circuit board made, but that costs money (I think I calculated $40 to $60) and I feel like contracting out something that I'm perfectly capable of doing myself is not in the spirit of DIY. Besides, this outer is primarily intended to make circuit boards. So if it works out well, I might have it re-build itself. 

After getting the circuit on the board, I still have a lot of work to do on the firmware. I'm still a little uncertain if I can control all 3 motors in with proper timing. Luckily, after browsing my code, I've realized I still have room to optimize if needed. And I can always ru the PIC at 40MHz.  I also have to work out a way to control the dremel through software. I'm thinking of using the VCO to drive  a V/F converter, in turn driving a triac at the dremel. I've never done this type of circuit before, so I need to look into it some more. 

Saturday, May 30, 2009

Urban Agriculture II

Tomato Plants

My second attempt in my home garden is to grow some tomatoes. Less then a week ago, I went and bought some seeds and a hanging basket. Based on my herb garden and what I've read about growing tomatoes, I expected the tomato plants to take a week or more to germinate. Not so. I saw the sprout in about 3 or 4 days. The picture below was taken this morning, about 5 days after I planted the seed. I'm going to let it sit in this little cup in my window sil for maybe another week, then I'll move it to the basket outside.

I'm a little worried that I won't be able to keep in moist enough outside, so I'm thinking I'll design some kind of automatic hydration system. Ha... this is probably over kill, but it'll be fun over kill. That's all that really matters.

At the rate this seed has been growing, I might have tomatoes ready to go by the end of June, assuming I don't kill it. I'm expecting the end of July though. I can be patient. But now I have to think of some other vegtables to grow.....


Thursday, May 28, 2009

Urban Agriculture I


Finally Using All The Dirt In My Apartment


While Raleigh is far from being a metropolis, the part I live in is definitely more urban then suburban. There is plenty of unpaved land around, but not much close to me which is usable as a garden. So what do I do when I want to grow my own veg? 

Luckily my apartment faces North-east (ish) and has a decent sized balcony that I don't use often. But I pay for the space, so I decided to make the most of it. With a friend of mine, we decided to grow our own vegetables off both of our porches. 

The down side of my balcony, is that is is very enclosed and only the front gets any significant light. So planning and utilizing this space will be very important for growing food. The first step in my garden is growing spices. The spices don't require a large amount of space and multiple plants, I'm hoping, can share the same container. At the local hardware store I bought a 2' rectangular planter, some soil, and seeds. 

I decided to plant 3 herbs that I'd prefer to use fresh over dried. I chose Cilantro, Dill, and Parsley. I planted 6 cilantro plants in the same planter, spaced a few inches apart from each other. Being the quickest growers of the plants I chose, they were also the first to sprout. And what a relief it was. After over a week after planting, I still hadn't seen any sine of life in my planter, and I feared they would never grow. Not so. 

Dill requires slightly more space then the other plants, so I only planted two. Each plant was spaced a few inches more apart then the cilantro was. Dill was the second one to sprout and has been growing fairly well. Of the two seed I've planted, only one has sprouted. It's been about a week since the first dill broke through the soil so I think the second seed was a bad one. I'll probably give it a few more days, and then give up and try another seed. 

Parsley is the slowest grower of the 3 herbs I planted. A week after the first plants sprouted, I finally saw my first 2 parsley sprouts. I planted a total of six parsley plants, so we'll have a few days to see if the rest of them decide to come to life. 

So for the herb garden it's been good. I've grown plants inside my apartment before, and the biggest difference between inside and outside is how fast the soil dries out in the sun. I'm finding myself needing to watch over the plants much more when they are outside. This will play a big role in my agriculture project  for the next week. Tomatoes are the next plant I want to grow on the balcony and they are sensitive to dry soil. More about that in a later post. 

Monday, May 18, 2009

AutoCVC

Making 4 Hours of Work Take Only 3 Mins


I have to start by saying that I don't in anyway take full credit for this program. I did the lions share of the programming and interface design, but the initial idea came from my friend Rashmi Jha when we were students together (she's a professor now, and I'm still a student). The CVC program itself was written by Dr. Hauser, and Dr. Ahmed.

In a nutshell, the semiconductor industry learns a lot from making and measuring silicon MOS capacitors. But to get accurate information out of modern devices, the measurements have to be fit to models. Dr. Hauser and Dr. Ahmed wrote the CVC program to do this, but it's a command line program that processes 1 file at a time. On top of that, each file to be processed has to have only two columns of data and they need to be in the proper order.

One single experiment can yield 20 or more samples, of which we have to measure a minimum of 5 capacitors each for statistical reasons. For my own work, I typically measure these five different capacitors under 5 or so different conditions. So we are talking about hundreds of files which need to be processed and examined one at a time. This took hours, or days.
So Rashmi and I made AutoCVC. It is first a GUI that can access all the features of CVC. Second a batch processor for the CVC program (meaning it will run CVC on ever file in the given directory). Third it will isolate any two data columns and remove any arbitrary amount of header data. Fourth it will run simple statistical analysis of the extracted data for an arbitrary combination of the output files, including setting a fitting error threshold and scanning the files to see if they fall below it. And last, it will extract data from the output files and put them into a new file which can easily be imported into a spreadsheet and further manipulated or graphed.

Well it all sounds pretty unimpressive, but the bottom line is that what used to take hours to do, now takes seconds. We can process our data much quicker, and I'm happy. The downside: now our boss expects us to do a lot more work and to get the results to her quicker. Oh well....

Tuesday, May 12, 2009

Beer Pong Shot Clock

And He Drinks One At The Buzzer!!


I'll admit, I have only played Beer Pong a handful of times, but every time I've played the rules have been different. My brother, and avid player, has his own rule that you must throw your ball within a certain amount of time. To enforce this, he asked me to make a shot clock. Simple enough project, and good for a slow weekend.



The concept is simple. There's a button on back. Press it to start the timer. Press it again to reset the timer. Hold it for ~3 sec to change the timer initial value. Hold for another 3 sec to store the value to EEPROM and reset the timer. When the timer is done, it blinks on and off to alert you. And finally if the timer is idle for 2 mins (no button press) then it shuts itself off and enters a low power sleep mode. It is meant to run off a battery and drunk people don't often remember to turn things off or put them away. There is also a jumper next to the button where you can hook up a second button. It would have the same functionality, but it allows remote operation of the timer (say if you placed the clock in the middle of the table). You can also split this into two buttons if you wanted, and each end of the table would have control over the timer.


The timer itself works fairly well. Setting the timer can be a little glitchy at times, and I'm not 100% sure why. The battery I used was taken from an old printer that I had disassembled, and the voltage it was reading was a bit lower then it should have been. I suspect the battery is towards the end of it's lifetime and when the LEDs are lit, it is not able to provide enough current to program the EEPROM. I have to investigate a little more to know for sure.

There are still quite a few pins available on the micro controller and 2 unused pins on the shift registers. In the future I might add some red LEDs around the edge of the timer like a real shot clock. I also want to add a buzzer to this to give an audible alert. The LEDs are fairly bright and not hard to miss when they are flashing, but it might be nice to have a sound too. I included an ICSP port on the back, so adding these features in the future shouldn't be too hard. Look for a future post.

Monday, May 11, 2009

Gameshow Style 'Buzzer'

Are You Ready To Play!!!!!

Although it doesn't actually buzz, I'm still calling it a buzzer. This project was commissioned by my mom. She runs a youth group back home, and they play a game like 'Jeopardy' and needed a way to definitively tell who buzzed in first. This project was proposed about a year and a half ago, and at the time the only micro controllers I had around were some PIC 18f452, and they run ~$8 each. Also they are overkill for something this simple. So I had a choice to use a uC or to try to use analog IC's. I chose to build an analog circuit, but if I had to do it again, I'd probably use a simple, cheap PIC just to avoid the hassle of wiring up this circuit by hand. Although, with a printed circuit board, the analog solution would have been great.



The circuit is fairly simple. The heart is a 555 timer set to oscillate. The frequency can be set by setting R10, R11 and C1 (the frequency isn't critical, so I think I put it in the few KHz range). The timer clocks a few D-type flip flops, allowing their values to update. At the input of the flip-flop are the switches, for this project I used some arcade buttons I had lying around because they are big and durable. The switch triggers the flip flop (Q'), which lights up the LEDs at the switch and at the controller indicating what button was hit. The other flip-flop output (Q) triggers some OR gates, which disables the 555 timer, stopping the flip-flop clock and preventing any other buttons from lighting an LED. A master reset button on the controller clears the flip-flops, in turn clearing the LEDs and restarting the oscillator. By using a toggle switch here, the flip-flops can be kept in a reset state, disabling all of the buttons. This allows the person in control to keep people from chiming in early, say if you want them to wait for a question to finish being asked.



There is a slight chance that two people (or more) hit the button at exactly the same time, in which case both (or more) of the flip-flops will be triggered before the clock is disabled. At 10KHz, the best case scenario is that the buttons have to be pressed within 1 clock period (100 us) of each other for this to happen. Accounting for flip-flop and gate delays would probably add a few 10's of ns to this number. In practice this hasn't been an issue. But if it is, increasing the clock frequency should reduce the probability of simultaneous triggering.

An added bonus of the analog solution, is the relaxation of conditioned voltage. I'm running this circuit of 4 AA batteries, which is 5~6V. depending on how fresh the batteries are. With 6V and a uC, this would need to be regulated down to 5V or below to protect the uC. With the analog solution, the chips are typically rated +/- ~15V or more, so regulating the power supply is not needed, provided it's a DC source within the range. The 555 timer is insensitive to supply voltage, so the frequency is stable as battery life decreases.

Tuesday, May 5, 2009

Mini-Pong


For some reason I'll never know, I've always loved Pong. When I first started computer programing I wrote a Qbasic version, and a Ti82 calculator version. When I learned a new language, I'd write a version of Pong in it to test my skills. This one is written in Flash ActionScript and was meant to be added to a Myspace or Facbook page. Feel free to test your skills, and pardon any bugs.

Monday, February 9, 2009

Shrimp and Vegetables in Brown Sauce



A Chinese inspired dish

Ingredients

1/4 lb Snow peas
1/2 lb shrimp
1 med onion
1 Green bell pepper
1 ~2" piece of ginger
1/4 pound mushrooms
2 cups white rice
salt and pepper to taste

For the Sauce

3 tbs soy sauce
3 tbs vinegar
1~2 tbs Sesame oil
1~2 tbs water
1 tbs flour
1~2 tbs sugar
clove of garlic (minced)

Bring 3 cups of salted water to a boil while rinsing the rice. When at a boil, add the rice, reduce to medium heat and cover.

Halve the onion and slice both halves into smile shaped strips. Cup the mushrooms into ~ 1/4 chunks. Cut the snow peas in half then slice the ginger into thin strips. Peel and slice the shrimp into chunks (if you want). Slice the green pepper into strips.
Pour some oil into a large frying pan (or wok if you have it) and put on a medium heat. Then add the vegetables, salt and pepper to taste, and let cook for 5~10 mins until the onions and mushrooms begin to sweat out, stirring occasionally.

In the mean time, add the soy sauce, vinegar, sesame oil, garlic and sugar in a small sauce pan and put on a med heat. Whisk together until all the sugar has dissolved, then add the flour continuing to whisk until all the lumps are out. Let it simmer for a few minutes until a thicker consistency is reached. If it is too thick or two strong you can add some water to thin it. leave it on a low heat, with occasional stirring to prevent a skin from forming.

Next add the shrimp to the frying pan. When they begin to turn pink, you can pour the sauce in and stir.

Give a scoop or two of the stir fry on top of a few scoops of rice and eat.







Tuesday, January 6, 2009

Tiger Cookies


I made these delicious cookies after a bogo sale on Reese's peanutbutter chips. They are a basic chocolate chip recipe using Reese's chips instead of chocolate and with melted chocolate on top. Not hard to make, but a little time consuming. Well worth it though for a rich treat, but I'd advise you not to eat too many unless you want to put on a few pounds. Thank goodness my gym is open again!

Tiger Cookies:

2.5 cups flour
1.5 cups sugar
1/2 stick butter
1 tsp salt
1 tbs baking powder
2 eggs
milk (or creme)
1 bag Reese's peanut butter chips
1 bad chocolate chips

--this recipe is from memory and might be slightly off. adjust as you see fit--

Preheat oven to 350C

Beat eggs, sugar and butter until well mixed and the mix starts to stiffen. Slowly add the flour until thoroughly mixed. Add the salt and baking power. Fold in most of the bag of Reese's, setting aside a small handful of chips for decoration later.

Spoon out about a 1" balls spaced 1"~1.5" apart onto a greased or nonstick cookie sheet. Bake for ~12 mins at 350C until the tops are just barely golden brown. Set cookies aside to cool and harden slightly.

While baking you can start melting the chocolate chips in a double boiler. Stir in a few tbs of milk to thin the chocolate. When cookies are sufficiently hard, dip the tops and sides in the chocolate and set aside to harden. When all the cookies have been dipped, you can go back and double dip or cover up and unfilled spots with any remaining chocolate.

While letting the chocolate set, clean out the double boiler and start to melt the Reese's chips set aside earlier, again with a small amount of milk. To make the stripes, I dipped a fork into the melted Reese's and dabbed the mixture along the hardened chocolate in a line. You can be as creative here as you want.

Again let the stripes harden and serve.