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.