Saturday, April 12, 2014

Arduino on a breadboard with AMT1001 sensor and seven segment display

As efficient as attiny85 may be, you can't run the seven segment library without using another chip.  So for this project, I will have the arduino display the readings of a humidity and temperature from a cheap AMT1001 sensor into a 4-digit seven segment display I salvaged from an old clock. Instead of using an arduino board, I will make an arduino on a breadboard and save the arduino for another project later on.  


Here's the detailed instruction on how to build the arduino on a breadboard. I skipped the parts for the power supply as I plan to power mine with 4 AA  rechargeable batteries. I also did not include the usb to serial board since I will use my arduino to program the atmega chip on the breadboard.
 
It is tight but everything fits on the small breadboard with no room to spare. The seven segment I salvaged was meant to display time so I just stuck a small tape on one of the dots of the colon to make it a decimal. Here it is ready to be powered.

Until now, I still can't believe how the seven segment library works. It is so clever! I thought I would at least see a little bit of flicker because only one segment would be lit at any given time.  I'm really surprised that the numbers look steadily lit.  Even at 60 frames per second, it doesn't flicker at all.

Here it is displaying temperature and humidity.  I programmed it to read the sensors very 4 seconds but it displays the values alternately every second. 

Notes on the AMT1001 sensor:

There isn't a lot on the arduino community using this sensor so I had to dig long and hard to find the calculations to be done on the sketch.  The humidity part is straightforward but I find the temperature reading to be a couple of degrees inaccurate. It uses a thermistor and I had to use an external 10Kohm resistor for the temperature reading.  I compared the value to the LM35 reading and it's giving me a reading of at least 2 degrees lower. To triple check the values, I compared it to a room thermometer and the LM35 is very close.  So I concluded that it's really the AMT1001 that is off. I would probably just use it for the humidity reading and stick with LM35 for the temperature.

Here's a video of it with the thermometer for comparison: http://youtu.be/ShHf0ecPVl8






Saturday, March 29, 2014

Creating a 2-Player Blender Game

I've played around with blender a bit and while my favorite is still VFX, I wanted to explore other things it can do. This time, I created a game. To keep it simple yet challenging, I made a 2-player football game.

My son has a stuffed toy he's really fond of so I based my game character on it.
Droozy
The character is quite simple so it was relatively easy to model. I got distracted for a while because I enjoyed recreating the fur using particles and rendering in cycles but after a while, I decided to remove the textures and particles of the character in the game.
Modeled Droozy 
Unlike the robot I used in my previous video which came from blendswap, I needed to rig the character myself.  With the help of the awesome people on the net, I was able to rig my character and got it ready to be animated.
Rigged Droozy
As it is, I can use it to composite a Ted-type movie effect which I plan to do later on but right now, let's get it to play some football.  I animated a run cycle that will loop to simulate a running character. Once I got that working, I added the other elements like the goal, ball, field, and set the properties.  Without any programming, I got the keyboard input to control my character.

I was going for a split screen view which took a bit more research.  Each player has a camera assigned and will follow them as they move around.  I found a viewport.py script that does just what I needed. It was just a copy-paste effort and I didn't need to touch the code itself so non programmers will still be able to follow along the tutorials.

To keep it simple, I didn't implement a scoring mechanism but I added some effect whenever someone makes a goal. After which, the game can be reset by pressing "N".  Here's a video of the game.  I recorded it using camstudio so the frame rate isn't that high.

 

Seeing the priceless look on my son's face after showing him his favorite stuffed toy come alive in the game,  makes all the trouble worthwhile. =)