My Music Videos
Tagsaktifitas-skripsi arduino belajar arduino Cutting bits download ebook ebook-online electronic english filsafat for-sale fpga hobby indonesian indonesian. hobby instrument mechanical microcontroller multicopter project music recording network perkakas mekanik piano programming propeller rc-plane research Riset riset s3 saxophone scilab scilab code sensor skripsi teori teori elektronika tricopter tutorial tutorial arduino tutorial plc utak-atik web
- November 2016 (1)
- January 2015 (1)
- December 2013 (1)
- September 2013 (1)
- July 2013 (13)
- January 2013 (8)
- December 2012 (3)
- November 2012 (3)
- October 2012 (4)
- September 2012 (1)
- August 2012 (19)
- July 2012 (9)
- June 2012 (15)
- May 2012 (4)
- April 2012 (1)
- March 2012 (11)
- February 2012 (10)
- January 2012 (34)
- December 2011 (57)
- November 2011 (4)
- October 2011 (3)
- September 2011 (2)
- August 2011 (4)
- July 2011 (2)
- June 2011 (1)
- May 2011 (2)
- April 2011 (1)
- 3d Hornet V2 Electric Plane (1)
- 3d plane (1)
- Aerial Photography (5)
- aeromodelling research (4)
- Arducopter (1)
- Arducopter 2 Mega (2)
- Arduino (11)
- Camera (3)
- Camera Mount (2)
- Carbon (3)
- collective pitch (1)
- Control system applications (1)
- CopterControl (4)
- DIY (3)
- Electronics (30)
- Elektronika (9)
- Equipment (3)
- filsafat (6)
- foamy plane (2)
- for-sale (3)
- FPV – First Person View (1)
- Gopro HD (1)
- gopro karma (1)
- Grup Riset (1)
- Hardware (4)
- Hexacopter (5)
- hobby (23)
- RC Model (20)
- instrumentation project (2)
- KKmulticopter (4)
- mechanical (3)
- Cutting bits (2)
- Mikrokontroler (5)
- Multicopter (20)
- Multicopter Frames (15)
- Multicopter Motors (3)
- Network (2)
- OpenPilot (6)
- Pemodelan (1)
- pesawat model (1)
- PLC (2)
- PPM (1)
- propeller (2)
- Quadrocopter (2)
- RC (5)
- Reviews (3)
- riset s3 (3)
- Sensor (4)
- Sistem Kontrol (39)
- skripsi (10)
- Software (1)
- The Hornet 3D Foamy Electric Plane (1)
- Transmitter (4)
- tricopter (12)
- Turnigy (2)
- Tutorial (9)
- Arduino (8)
- Uncategorized (10)
- Utak atik (19)
- Video (37)
- Y6 (5)
- Gopro Karma recalled
- Presentasi Ujian Terbuka Disertasi
- Collective pitch quadcopter
- Grup Riset: Low Cost & Automated Method and Instrumentation Analysis
- I’m in The Mood For Love on Tenor Saxophone (Cover by Bambang Siswoyo)
- Dinda Bestari on Sopran (Indonesian Song, Keroncong)
- Kucari JalanTerbaik on Sopran Saxophone (Cover, Indonesian Song)
- Kucari JalanTerbaik on Tenor Saxophone (Cover, Indonesian Song)
- Bambang Siswoyo on Programming tools for XILINX FPGA — Platform Cable USB
- Bambang Siswoyo on Arduino tutorial: How to turn on/off 8 LED using visual basic 6
- Charles Harris on Arduino tutorial: How to turn on/off 8 LED using visual basic 6
- house sklep internetowy-kielce on Programming tools for XILINX FPGA — Platform Cable USB
- Adam on Arduino tutorial: How to turn on/off 8 LED using visual basic 6
active 1 hour, 35 minutes ago
active 5 hours, 51 minutes ago
active 7 hours, 7 minutes ago
active 9 hours, 33 minutes ago
active 21 hours, 46 minutes ago
active 1 day, 2 hours ago
active 1 day, 7 hours ago
active 1 day, 9 hours ago
active 2 days, 10 hours ago
active 2 days, 13 hours ago
Tag Archives: arduino
Last updated byat .
For users with arduino microcontroller has one serial port, such as nano arduino, uno etc., can use the digital port as an additional serial channel. I tried it into the arduino nano board, and will add an additional serial port to D10 as RX and D11 as TX. D10 (RX), D11) is a serial software controlled, unlike the RX (D0) and TX (D1) working in hardware. Required libraries that support additional serial operation, simply add the syntax:
at the beginning of the arduino program. To test the digital pin is used as an RS232 serial communication channels, required-digital USB-Serial dongle.
In this post, will describe how to use an interrupt event of timer2 using nano board. If you want a process that works in the background and separated from the function loop (), you can use timer2. Timer2 can be set as a timer with overflow mode. When timer2 overflow, certain vector address to be executed. In arduino, vector address to timer2 with overflow mode is TIMER2_OVF_vect.
Initialization of timer2
First you must initialize timer2 as timer overflow mode. To initialize timer2 use the following code:
The code to initialize timer2 can be explained as follows:
- At line 10 aims to disable timer2, so that does not work.
- At line 12 aims to set timer2 to become overflow during 10ms.
- At line 13 aims to clear flag interrupt of timer2. Each 10ms this flag will be set and will execute address of interrupt: TIMER2_OVF_vect
- At line 14 aims to enable timer2 interrupt as overflow mode.
- At line 15 aims to set wave generator normal of timer2
- AT line 16 aims to set prescaler of timer2 to 1024
How to calculate time of overflow interrupt
The equation is:
t = (1/F) * 1024 * (255 – R) * 1000 mS
F is frequency of microcontroler in Hz
R is value of TCNT2 register
For example timer overflow will generate every 10mS (t) dan F is 16000000MHz.
10 = (1/16000000) * 1024 * (255-R) * 1000
(255 – R) = (10 * 16000000)/(1024 * 1000)
(255 – R) = 156.25
R = 255 – 156.25 = ~98 (decimal)
Routine of timer2 overflow interrupt
If the register is set to 98, the routine of timer2 overflow interrupt will be executed every 10ms. Address of vector interrupt is TIMER2_OVF_vect.
In this routine thing to do is to set TCNT2 = 98, so the routine is executed again every 10ms. Additionally TIFR2 set to 00, TIFR2 = 00.
Next, you can add the code in this routine, such as a counter or other variables. Make the code as short as possible, try the code created only manipulate variables.
Codes above can be explained as follows:
- Line 21 and 22, set timer2 counter to 10ms and reset timer2 interrupt flag.
- Line 24 to 28, change the logic of variable flag_led as toggle every 500ms, using variable flag_500ms as counter to get again time of 500ms.
- Line 24, check the flag_500ms whether zero. If zero is reached, flag_led will be invert (line 26). Next on line 27 refresh flag_500ms become value of 50 as time counter of 500ms.
Setup() and Loop() functions
The code of setup() and loop() functions be explained as follows:
- On setup() function, line 35 configure D2 to D9 as digital output. Line 36 setup the variable of flag_500ms = 50 for 500ms counter based on 10ms. Line 37 init the timer2 as timer overflow interrupt for time of 10ms.
- On loop() function, line 42 and 43 set D2 to D9 with logic 0/1 based on flag_led variable.
I will share my experience about how to turn on and off 8 leds through the widget made using visual basic 6. I am using visual basic 6 because the file is not large and light program execution.
How its work ?
8 pieces led Arduino connected to a digital channel from D2 .. D9. Each LED in series with a resistor about 120Ohm is connected to GND. Thus each led will turn of in a logic 1.
On the Arduino board, was created a program to accept the character as a command to turn off and turn on each LED. Command of the character of 1,2,3,4,5,6,7,8, used to turn on or turn off each LED on arduino board as toggle function. Other characters as command of “*” character serves to turn on all LED. The character “-” to order all led to turn off.
Each character as commands are sent serially to the Arduino board. Thus, the Arduino will send back all conditions of leds in string form., for example, “10101010″. The character “0″ means the condition of the LED is die and vice versa “1″ is alive.
Variable and serial event
As a global variable is “charCmd” defined as byte to hold a character as a command that sent from the PC. Variable of ccmdOk defined as boolean is a flag to mark that character just received from PC. The special variable is stateLED defined as char. This is for holding the state of 8 LEDs in bit for each LED.
The serialEvent() function is event interrupt of microcontroler. This function by default on arduino will call automatically if just completely receive a char from RX pin. If the character has been received from PC, the result will be stored in the variable of “charCmd”, then flag of “cmdOk” is set to “true”.
Two functions are made to treat the LED on the Arduino board are:
Serves to turn on or turn off each LED corresponding to logic of each bit in the variable conditions of stateLED. Line 28, is looping to get each bit of stateLED variable. Every bit of stateLED variable, is tested using bitRead function(). Thus, written to digital channel of arduino. The status of each led is sent to serial and received by PC as hanshaking or display status.
This function serve to invert the logic of each bit on stateLED variable, indexed by n variable. This function have one passing parameter to point each bit on stateLED variable.
This initialization are open serial using 115200baud and making D2 to D9 as output, also all LEDs turn off. For shortened codes, i used loop of for() statement and variable of d is used as index of digital channels that to be connected to LEDs.
The loop functio () checks if there are characters that is sent by the PC. If the variable cmdOk = true, then there are characters received from the PC is stored in the variable of charCmd. Next tested whether the character is ’1′ to ”8′, ‘*’ or ‘-’. If the character are ’1 ‘to ’8′, will call the function of invertLED, means reversing the logic of each bit on variable of stateLED. If the character is ‘*’, stateLED will be assigned to 255 (all LEDs will be turned on), ‘-’ stateLED will be assigned to 0 (all LEDs will be turned off).
Source code of arduino program can be downloaded here.
Widget of visual basic 6
I made this widget by using Visual Basic 6. You can install directly to a computer to download the setup program by clicking here. Or you can download the source program by clicking here. Do not forget to include the name of program creator, and web link on your project.
Here will be explained about Arduino for beginners. For the programming hobbyists in hardware using microprocessor or microcontroller, the Arduino is an easy choice to make the program like the computer platform programming.
On computer programming, relations with the hardware for input/output is not necessary to memorize the pin numbers of the hardware. If you are on a microcontroller environment, must know the pin number that will be used for input/output. Furthermore it should understand the basic philosophy of how to treat the pin.
Arduino is an IDE for programming microcontroller in order to develop the software as well as computer software development environment.
Easily obtained using arduino IDE, among others:
- The programming language used was C / C + + or combined with the assembly.
- Microcontroller pin numbers are known as fixed by classifying digital or analog channels. Any microcontroller with a label known for Dx to digital, analog to Ax, where x is the channel number. Thus you do not need to remember pin numbers on the microcontroller used.
- Programs that have been made using Arduino, can be easily applied to other microcontroller which is recognized by the Arduino. The program does not need to be changed, simply change the configuration of the microcontroller’s used.
- To add a new library can be built easily by using C / C + + or combined with the assembly. To integrate with the Arduino program, with enough to include the header of library that will be used. Thus very easy to integrate libraries made by the contributors for use by other users.
- Very easy to compile, there are two upload menu to compile and upload, verify menu to compile it. Library search process is done automatically.
How to start ?
Learn to start applying the Arduino, I recommend to you to have an Arduino board first. Avoid advance to make an Arduino board from microcontroller chip. For first, begin to learn programming with a simple application. Many types of Arduino board, more details you can click here.
Next, you must install the Arduino IDE, you can get for free by downloading here. I assume you have a nano to use a microcontroller ATmega328 board. More details about the specifications of this board you can see here.
Connect the Arduino with a USB interface on your computer, then run the Arduino IDE by clicking on the icon’s arduino. The first time you have to choose a board that suits you use. For that, click the menu: Tools-> Board.
Every time you change the type of the Arduino board, you must change the configuration of the appropriate board in the Arduino IDE. Most important is the type of microcontroller used and the frequency used must be matched on this configuration by typing menu.
Examples of program “blink” will appear as follows:
The logic of the program can be described as follows:
- There are two default functions, there are two setup() and loop() and must exist in the program. Setup () function as program initialization before the loop() function is executed.
- Loop() function is a substitute for the function main() in C programming language in general. The difference of this function will perform a continuous loop when the end of code is executed.
- The code in line 11 is initializing channel digital channel 13 (D13) as output. This channel is connected to the LED on the Arduino board type nano.
- At block loop () there are 4 lines of program code, line 15 is writing of logic one to D13. And will turn on LED, because there are pulldown series by resistor.
- Line 16, execution of time delay function with parameter passing 1000 as 1000ms or 1 second. This means that the LED will be turned on for 1 second.
- Line 17 is writing of logic low to D13. And will turn off LED.
- Line 18 similar with line 16, will executed time delay function about 1 second. This means tha LED will be turned off for 1 second.
- Go to line 15 again, because loop() will executed as looping.
To compile and upload to the board nano is very easy just click the upload icon.
please wait for video
I’ve created an Arduino ATmega328 built on a perforated veroboard. To connect between pins, I use in soldering wires directly. I use a 16MHz crystal clock and the Arduino will recognize as a board of “Nano Arduino w / ATmega328″.
In order board is easy to use, I added a header connector as in the rc receiver configuration is GND / +5 V / Signal. To facilitate the program upload the ISP, pin TX / RX / RST microcontroller mounted single header connectors.
RST microcontroller connected to the RTS of the serial interface using the USB dongle that works automatically reset. In addition, I added the LED on the D9 in order to test whether the Nano board can work well.
Next I will test this board for the throttle of the brushless motor. I am using the simple program that has been available in the example program.
I use a 3S lipo, 18A ESC as a 5V voltage source Arduino board. Potentiometer connected to ADC0 or A0 pin to set the throttle.
In March, 2012, visualmicro.com released a plugin for the Arduino using visual studio. For those who are tired of using the original Arduino IDE, can use visual studio as a new IDE. Thus visual studio will be used as an Arduino-based microcontroller development.
This plugin can be used in Visual studio 2008 or 2010 version. I tried it using Visual Studio 2010.
I like visual studio, because the windows look very comfortable and can be configured. Moreover, it can add a facility other programming languages which have been there before in visual studio. I’m most looking forward to is the ability to debug the program to be developed. Debug capability is still in beta, is still tested by the tester, I am one of them.
Here I will explain how to install the plugin for the Arduino, in visual studio 2012.
The installation steps are:
- Install Arduino IDE ver. 1.0.1
Arduino program still used by the plugin. Use the release version of the Arduino.
- Install visual studio 2008 or 2010.
You can choose one of them, I chose which 2010 version.
- Download plugin arduino fro visual studio here.
You should always follow the latest version, because the plugin was developed from time to time. Install the program and will be in the folder: C:\Program Files\Visual Micro\Visual Micro for Arduino.
- Run visual studio.
Visual studio configuration
After your Arduino 1.0.1, visual studio 2010 and Arduino plugin, run visual studio you will see there is an additional menu.
On the File menu there is a sub menu “Arduino project” serves to create a new project based on the Arduino.
While on the Project menu there are sub menu “Add New Arduino item” which serves to add a file in the Arduino program are c, c++, arduino. The second sub menu is “Add arduino library” used to include library from core or user.
Additional sub-menu is the menu as found in the Tool menu in the Arduino. For those familiar with the Arduino, already knowing the functions of this menu.
Next, you must configure it to show where the location of the Arduino program is placed, by pressing the menu Tools-> Options.
In addition to my experience visual studio requires additional database program that is “Microsoft SQL Server compact 3.5″, the program can be downloaded here.
If you build your own Arduino with ATmega328, when integrated with a serial upload utility, will fail as I did. But if you re-use the old version of the Arduino IDE such as 0023, certainly not a failure.
Surely you will be disappointed, because the Arduino IDE version 1.0.1 has certain advantages not possessed in the previous version.
In the release version of the Arduino started version 1.0.0, has advantages compilation faster because only compile files that experience a change in editing the source. Obviously this is very loved by the users, because the development process will be faster.
When you use the original Arduino board, such as nano board, a serial upload process does not fail. Due to the release version was added a upload facility via the programmer, as you do to fill the bootloader. I never gave up, so use this facility and not use the serial. But using less programmer takes the number of pins: MISO, MOSI, SCK, but upload is only using pin serial RX / TX. I think the serial uploading is more effective manner, does not reduce the use of pin and at the same time for data communication or debugger.
I find the problem why this happened, because I think the same principle and use the same chip.
Finally I managed to modify the configuration file so that the upload is successful series in the Arduino IDE version 1.0.1. using a homemade board of the ATmega328.
I also like to reset automatically when the upload program. For that you must connect the RTS pin of the USB-Serial to TTL module to the ATmega328 RESET pin (pin 1). This way you do not need to manually press the RESET button, every upload program. In addition also connect the RX / TX between ATmega328 (see 2.3) with a USB-Serial to TTL module. in pairs. Also do not forget to GND should be connected as well.
Boards.txt file modifications on the Arduino IDE ver. 1.0.1 using handmade ATmega328 Arduino Board
I found a way to change files in the folder of boards.txt \hardware\arduino\boards.txt.
Handmade Arduino board is configured as a Nano-328 board. You must change the configuration of the board.
nano328.name=Arduino Nano w/ ATmega328 nano328.upload.protocol=arduino nano328.upload.maximum_size=30720 nano328.upload.speed=57600 nano328.bootloader.low_fuses=0xFF nano328.bootloader.high_fuses=0xDA nano328.bootloader.extended_fuses=0x05 nano328.bootloader.path=atmega nano328.bootloader.file=ATmegaBOOT_168_atmega328.hex nano328.bootloader.unlock_bits=0x3F nano328.bootloader.lock_bits=0x0F nano328.build.mcu=atmega328p nano328.build.f_cpu=16000000L nano328.build.core=arduino nano328.build.variant=eightanaloginputs
In the second line of text:
The completely configurations of boards.txt file will be:
nano328.name=Arduino Nano w/ ATmega328 ### nano328.upload.protocol=arduino nano328.upload.protocol=stk500 nano328.upload.maximum_size=30720 nano328.upload.speed=57600 nano328.bootloader.low_fuses=0xFF nano328.bootloader.high_fuses=0xDA nano328.bootloader.extended_fuses=0x05 nano328.bootloader.path=atmega nano328.bootloader.file=ATmegaBOOT_168_atmega328.hex nano328.bootloader.unlock_bits=0x3F nano328.bootloader.lock_bits=0x0F nano328.build.mcu=atmega328p nano328.build.f_cpu=16000000L nano328.build.core=arduino nano328.build.variant=eightanaloginputs
That means using the STK500 protocol for serial usb-serial to ttl module, while the “arduino”, is the original Arduino board serial protocol. Finally, you must reboot the IDE arduino for new configuration.