Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Wednesday, January 21, 2009

Arduino Oscilloscope



If you are interested in electronics and haven't heard about Arduino yet then you should definitely check it out. I got a Duemilanove for Christmas and it's been great fun so far. Before I bought the Harmony 880 the wheels in my head started spinning, I was thinking about how I could use Arduino to make a Universal Remote. I found an article that discussed how to start making one and what the code would look like. Sadly I don't have an oscilloscope and don't plan on spending the money for one anytime soon either. With more wheels turning I researched making an oscilloscope with the Arduino and found another article on how to do this. So now I'll show you what I've done so far to create an Arduino Oscilloscope.

First you do need to have the Arduino IDE and Processing installed on your machine (both pieces of software will run on PC, Mac and Linux). Then go to the Poor Man's Oscilloscope post and download the .PDE file that holds the processing and Arduino code. Open that file with a text editor and copy the bottom section that starts after the line
          '// The Arduino code.'
and paste that into the Arduino IDE. Now you need to hook the Arduino up to the computer and upload the sketch to the board. If this is the first sketch you are uploading I would suggest buying 'Getting Started with Arduino' by Massimo Banzi (one of the creators of the Arduino Board). There is also a getting started guide on the Arduino website. Select your operating system on the left side and that will get you up and running.

Now you need to add your sensor to Analog Pin 0 and the Vin pin. If you are trying to make an IR Decoder for the Universal Remote project you will you the IR Phototransistor into the board.

Now close the Arduino IDE and open Processing. Start a new sketch and paste in the top portion of the code from the .PDE file you downloaded (This will be all but the part we used before). You may have to change the serial port number depending on what port your Arduino is plugged into on your computer. Count the number of ports above the one you are using to connect your Arduino (not including the Arduino port) and change the line that reads:
          'port = new Serial(this, Serial.list()[0], 9600);'
change [0] to however many ports are above the one you used in the Arduino IDE to connect to the board. Run the Processing sketch and it should show you a real time graph of the input. It would probably be a good idea to test the program by doing something similar to the video above. Insert an LED and turn the lights on and off to see if you get any movement in the graph.

That should be about all you need to know. Use the comment section to discuss how you modified this project or any other Arduino projects that you've been working on.

Tuesday, October 7, 2008

Microsoft Expression Blend

Until recently the way Microsoft allowed you to design windows programs with .NET was called Windows Forms and this feature set of familiar looking tools was built into Visual Studio (which is a relatively expensive program but makes editing code much easier). Now Microsoft has released Expression Blend, the new way to create Windows Applications. Guess what, Expression Blend is a completely separate program from Visual Studio. You know what else, you can't edit your code directly from Expression Blend either now. So if you want to use the newest Microsoft technologies you have to fork out the money for both programs.
Now that I've got that out of my system I'd like to introduce you to creating Windows Applications with Expression Blend through what Microsoft calls WPF or Windows Presentation Foundation. Essentially you don't need Blend to create forms through WPF but it's a lot easier if you do. CoDe magazine online has a great article that helped me get started using WPF called WPF meets iPhone. This tutorial takes you through the steps of creating a new project from scratch making an interface similar to the iPhone. The online article has everything you need except Expression Blend and C# 2008 Express or VB Express (depending on which language you prefer, the tutorial offers code samples for each) including the C# and VB source code and all the resources needed. Following the article isn't hard and taught me enough to start creating my own forms with Expression Blend.
If you like this article and use Microsoft Technologies for your programming I would highly suggest subscribing to the magazine. You can read a lot of the content online, but as usual subscribers usually get a little more content.
Try and put your own twist on the iPhone interface and