Buy Arduino in Vietnam
Just found out there’s a shop that supply Arduino in Vietnam, HCM City.
Home page: http://www.sotatec.com/arduino
If you’re in Vietnam, you can contact:
Địa chỉ: 162 Đường Số 7
Số TK (VND): 2100 1485 1007 957 (Ngân hàng Eximbank – Chi nhánh Bình Phú, Tp. Hồ Chí Minh)
or, get accquainted on Facebook: Sotatec Facebook Page
and the owner: Nghia Hoan Ho Facebook
Week #02 – Fade a LED
One simple Arduino project every week!
(1) Objectives
- Know the concepts of PWM.
- Apply it to change brightness of the LED.
- Make LED fade in and fade out.
(2) Requirements
- An Arduino board, of course.
- A LED.
- Adapter cable to connect Arduino and PC.
- Some wires and breadboard if needed.
(3) Setup
- Plug the LED to the board.
- Connect the GND with short leg.
- Connect the long leg with pin 3.
(sorry, I don’t have Fritzing at the moment, but in the next coming projects I will try to use it).
(4) Explanation
Q: Why pin 3?
A: Please get the concept of PWM (Pulse Width Modulation) first; then check your board to know which pins are PWM. On my Arduino UNO, the PWM pins are: 3, 5, 6, 9, 10 and 11.
You can get more information about PWM here: http://arduino-info.wikispaces.com/Arduino-PWM-Frequency
(5) Source
/**
* @author Pete Houston
* @Objective fade a LED in and out
*/
// use port 3
const int PORT_LED = 3;
void setup()
{
// nothing to do here
}
void loop()
{
// set init brightness value
int val = 0;
// start fade in
for(val = 0; val <= 255; val += 10) {
analogWrite(PORT_LED, val);
// wait for a while
delay(50);
}
// reset to max
if(val >= 255) { val = 255; }
// start fade out
for( ; val >= 0; val -= 10) {
analogWrite(PORT_LED, val);
// wait for a while
delay(50);
}
}
(6) Execution
- The source code is easy enough to understand.
- On your column breadboard, you can plug several LEDs in a line to see the fading effect. I plug three, and they’re fading fine.
(7) Final Words
- Just try to find out, what you’ve learned and known from this project? and what can you do further with this?
Cheers,
Pete Houston
Get the Multimeter
Phew, I’ve just received my order, the Multi-meter this afternoon.
Having some tries w/ electric, it seems to work fine; however, it’s a Chinese product, don’t know when it’s broken…lol
)
The price is $8.5.
If you are in Vietnam, just go and get it in “Chợ Giời” =))
Cheers,
Pete Houston
Use Samsung Galaxy Nexus Power Adapter as Power Source for Arduino
Well, just got from my Galaxy Nexus package the power adapter.
Some specifications:
INPUT: 100-240V, 50-60Hz, 0.15A
OUTPUT: 5.0V, 1.0A
This is my try…
Cheers,
Pete Houston
Week #01 – Blinking a LED
#There will be a tutorial every week that helps you learn Arduino with me.
As for every programmer, things are started at a “Hello World!“. However, for us, electrical engineer/hobbysts, we start with other thing, we light up a LED.
(1) Objectives (lesson targets)
- Learn the very basics of Arduino coding.
- We will need to light up a LED.
- Be able to blink it.
(2) Requirements (things to prepare)
- An Arduino board, I use Arduino UNO, you pick your own kinds, any will do.
- A LED light.
- The adapter cable to connect PC to Arduino.
- Visual Studio w/ Arduino plugin installed (if you don’t have, refer to my previous article – Arduino Plugin for Visual Studio)
#assuming that you’re already had experiences in programming C/C++.
(3) Setup (connect devices and objects)
- Use cable to connect PC and Arduino board.
- For LED, plug the long leg to pin 13, the short leg to the GND (stands for “ground”).
(4) Source
- Create a new Arduino project and run the below code:
/**
* @author Pete Houston
* @homepage http://tronixino.wordpress.com/
* @objective blink a LED
*/
/** constants **/
const int PIN_LED = 13; // port to use for LED
const int TIME_DELAY = 1000; // 1000 ms
/** setup **/
void setup()
{
// set OUTPUT mode for port 13
pinMode(PIN_LED, OUTPUT);
}
/** loop **/
void loop()
{
// light up the LED
digitalWrite(PIN_LED, HIGH);
// wait for a second
delay(TIME_DELAY);
// turn the ligh
digitalWrite(PIN_LED, LOW);
// wait for a second)
delay(TIME_DELAY);
}
(5) Execution
- Click F5 on Visual Studio to compile and upload to the Arduino board.
- You see the result as expect, the LED blinking every second.
(6) Final words
- This lesson is pretty much simple and easy, but if you’re absolutely new to this stuff, I’d suggest you try to read and follow properly. Also, use Google to learn and know a bit about things you don’t know in this lesson; it certainly helps you more in future stuffs.
- Do it, think it and mix it to complete!
Cheers,
Pete Houston
Get the place where you can learn & study Arduino
If you are new to Arduino and want to find a good source where you can learn firmly about Arduino, I’d suggest this famous address:
(+) Arduino Official Page – Tutorials
It’s really awesome, however, some articles are quite hard to understand and follow, but don’t worry, community is the best place where you can ask people for some helps.
You can ask:
(+) The author of this post, this blog. Yes, right! It’s me, I can help you.
(+) StackOverflow – Tag [arduino]
(+) StackExchange – Electrical Engineering Community
Some others sources might help also:
(+) ladyada.net – Learn Electronics w/ Arduino
Oh, well, hope it helps
Cheers,
Pete Houston
Arduino Addin for Visual Studio
As long as I use the Arduino IDE, I’ve found quite inconvenient to use it. Sometimes it messed-up my typing, something like tab and space indentation, curly braces…
After a while googling, found a great addin for Visual Studio: A complete Arduino plugin for Visual Studio 2008 and 2010

A Sample Look on VS 2010
Trying it for a while, I feel really love this, because:
+ it helps organizing my Arduino projects better.
+ have all views on one screen while developing.
+ fimiliar with my beloved C++ syntax highlight color.
+ intellisense on typing.
+ quickly navigate and run source on multiple Arduino devices simultaneously.
That’s all of the good stuffs.
You might wanna give a try for it: http://visualmicro.codeplex.com/
Cheers,
Pete Houston






Recent Comments