Installing Android Studio

In one of my older posts, Getting started with the Android SDK, I made a mention of Android Studio and how it would be replacing the Eclipse ADT plugin. Well sometime since then, it looks like the switchover has indeed happened and its time for me to ditch Eclipse take a leap into Android Studio.

Downloading Android Studio

Now that there is only one option to choose from, Google has streamlined the download process significantly since my last post.

Simply head over to the Android Developer page, and click Download Android Studio. Do your usual reading of the license agreement (you all do that, right?), accept, and you should be downloading all 800MB of Android Studio goodness! continue reading

Temperature Sensing with DHT11 on Arduino

Ahhh temperature sensing, something so simple yet can be integrated into so many different projects. How about a temperature controlled RGB LED? Or perhaps an Arduino controlled thermostat? Heck, even a full blown weather station! Your imagination is the limit.

There are a few different choices when it comes to temperature sensing such as a completely water proof analog temperature probe to digital sensors. I will be focusing on the DHT11 which is a very affordable (~$1) digital temperature and humidity sensor. Its good for sensing 20% to 80% humidity within 5% accuracy, and 0c to 50c within 2% accuracy, which is more than enough for any indoor projects. If you want something a little more capable and accurate, the DHT22 is another option for digital sensors.

The DHT11 has 4 pins in total as seen above (with 0.1″ spacing – perfect for breadboards). VCC, a Data pin, and Ground. Pin 3 is not used.

Wiring it up is fairly straight forward. Start by connecting VCC on the DHT11 to VCC on your Arduino, and Ground to GND. Next connect the DHT11 data pin to pin 10 on the Arduino. Lastly, we need a 10k (Brown Black Orange) resistor in parallel to the DHT11 connected between the VCC and Data pins. This is our pull up resistor.

Now its just a matter of uploading our sketch and checking the output in the serial monitor

//First we need to include the DHT Library #include "DHT.h" //Next we define which pin the DHT11 is connected to, in this case its 10 #define sensor 10 //We also need to define the type of sensor were using, which is the DHT11. //Other options are DHT21, and DHT22 if you are using those sensors #define sensorType DHT11 //Initialize the DHT sensor using the above variables DHT dht(sensor, sensorType); void setup() { //Start our serial port and dht sensor Serial.begin(9600); dht.begin(); } void loop() { //Read the temperature sensor, in celcius int curTemp = dht.readTemperature(); //Read the humidity, in percentage int curHumidity = dht.readHumidity(); //Output the information to our serial monitor Serial.print("Temp: "); Serial.print(curTemp); Serial.print("°C / Humidity: "); Serial.print(curHumidity); Serial.print("%"); Serial.println(); //Wait for a few moments as the sensor can only update so quickly delay(3000); } continue reading

Build your own Arduino starter kit

I have a friend that keeps asking me about micro controllers and costs associated with getting started. He has no prior programming experience, and doesn’t own a soldering iron. By the sounds of it, he’s a little on the fence (rightfully so) and isn’t sure whether he should try it or not. Totally understandable when starting with something new. So I figured hey, lets break it all down and see just what it would take to build your own Arduino starter kit!

Before I get into the actual costs I just want to point out that while previous programming experience is handy when it comes to Arduino, its not at all necessary! The Arduino community is literally huge (250k+ members worldwide, 2 million posts) which means finding a sketch and wiring examples that do exactly what you want it to do (at least when you are first getting started) is going to be very easy. My recommendation when starting out is to concentrate on small projects with the thousands of ready made examples (blinking, fading, controlling, etc.). This will allow you to familiarize yourself with the platform (uploading, debugging, etc.). Once you have a solid base is when the real fun begins and you can let your imagination run wild! continue reading

PWM control with Arduino

Just a real quick snippet today. If you followed along my first Arduino post (Getting started with Arduino) then you should already have a simple blinking LED on Pin 10 (or pin of your choice). I wanted to take that just a step further and use PWM (Pulse Width Modulation) for a fade in / fade out effect.

PWM uses a pulsing digital signal (high/low) to simulate the effect of an analog signal. If you really want to learn the technical details of PWM, head on over to the Arduino page – http://arduino.cc/en/Tutorial/PWM

The best part, no hardware changes! Simply upload this new sketch with the breadboard layout in the original post (below, in case you missed it)

// Our LED is connected to Pin 10 // Set a variable called LED for Pin #10 int led = 10; void setup() { // No Setup } void loop() { // Fade in from min (0) to max (255) for(int fade = 0 ; fade <= 255; fade++) { // Set the pin to output the value of fade analogWrite(led, fade); // Delay for 5 milliseconds delay(5); } // Fade out from max (255) to min (0) for(int fade = 255 ; fade >= 0; fade--) { // Set the pin to output the value of fade analogWrite(led, fade); // Delay for 5 milliseconds delay(5); } } continue reading

Tracking Down Unknown Network Devices

This is going to be a short and sweet post, but it touches on something I had to deal with just the other day.

I was going through my router, which I do on a regular basis, to check what unknown network devices were showing up in the network list. In my case I usually do this for two reasons. The first is to name all my devices in the router itself and typically assign it a static IP. The second is for pure security. I want to know what devices are on my network, and who the device belongs to.

The particular unknown network device that I noticed, and could not identify was named “GainSpand48cb6“. I usually take pride in naming my devices, so GainSpan was not something that I had setup. I made the assumption that the d48cb6 was the last 6 digits in the mac address, which I confirmed by looking at the device info more deeply. continue reading

Getting started with Arduino

Well its been so beautiful outside here lately *sarcasm alert* (averaging -40 degrees Celsius…) I decided now might be a good time to dust off my Arduino boards.

First off, if you have any experience with Arduino micro controllers, this post probably wont be for you. Its been many… many years since I have done any work with them (ahem… high school). I need to build my own skill set back up, so this is a recap for myself, and for those who might be just starting out (or looking to start out) with Arduino boards.

Second off, if you’ve ever used or are still using the Arduino IDE… scrap that. I came across a web app: Codebender which is basically a much better version of the IDE entirely through your browser. It features a fancy editor with syntax highlighting, much better error reporting (in my opinion), a cloud based compiler, and a built in serial monitor. It has all the features of the Arduino IDE, but adds loads more.

I have several different types of Arduino boards (Pro Mini, Uno R3, Duemilanove, and some mini knock-offs that don’t work worth crap – dswy_robot), but I will probably spend most of my time with the Pro Minis. They are amazingly cheap so if you blow up a board, you’re only out a couple dollars instead of $20-$30…sweet!

What You’ll Need

  • Arduino Pro Mini (or Arduino of your choice)
  • USBasp programmer (assuming you’re using the Pro Mini)
  • An LED
  • A resistor, 470 ohm is fairly safe when working with LEDs
  • Male header, or bread board wires

Getting Your Programmer Ready

Before we jump into it, we need to make a cable to connect the Arduino up to the USBasp programmer. Your programmer should have come with a ribbon cable, so its just a matter of connecting those pins up to the proper pins on the Arduino with some breadboard wires. You can use bread board wires to go from the 10 pin connector to your breadboard, or you can cut one end off completely and solder it to a header. It takes a few minutes longer to make the cable, but trust me, you’ll save time in the long run when you need to switch breadboards

Make sure you are oriented correctly, Pin 1 on your ribbon cable is the blue wire in the image above. When you’re all done, ideally you want to end up with a cable like this:

Make It Blinky Blink!

Alright, so lets get our LED wired up

Very simple. the anode (longer wire) of the LED connects to pin 10 on the Arduino, and the cathode (shorter wire, typically with flat side on LED) connects up to our resistor. Depending on your LED you can use a smaller resistor, I was using a very bright blue LED so I decided to go with a 470 ohm to dim a down just a touch.

Next we need to upload the sketch to the Arduino using the USBasp, so plug everything in, connect the programmer up to your computer, head over to Codebender, and upload this sketch.

// Our LED is connected to Pin 10 // Set a variable called LED for Pin #10 int led = 10; // The setup() function is called once when the Arduino is first powered up void setup() { // Set our LED pin as an output pinMode(led, OUTPUT); } // The loop() function runs over and over again forever void loop() { digitalWrite(led, HIGH); // Turn on the LED (pin 10) delay(500); // stop for 500ms digitalWrite(led, LOW); // Turn off the LED (pin 10) delay(500); // stop for 500ms } continue reading