caramoan tour package

caramoan tour package

Author Topic: Arduino - Sharing my experience programming the arduino as a hobbyist  (Read 1490 times)

Offline n0th1n6

  • Diesel Generator
  • *
  • Posts: 1986
  • Pogi/Ganda Points: 62
I am a bit late on this topic, considering that a lot of tutorial already exists in the internet. Two weeks ago, I had the chance to get my hands on an Arduino Uno board. It is the same as the one raffled at 1Diy



But what a waist it would be if I accidentally smoke that board while I am on my quest to the Arduino world, so Severino was born.



Severino 3 version 3 is the latest version of single sided board arduino that is officially supported by Arduino. It can be loaded with bootloader for Diecimila, Duemilanove, Nano, and Arduino Pro. I uploaded the bootloader using Arduino Uno with ArduinoISP loaded. First I tried Duemilanove bootloader and it uploaded successfully. But the moment I tried to upload a sketch, my 3 hours of **** scratching begins :D. It turned out that the auto reset function is a hit or miss affair with this board. Tried uploading the bootloader several times but to no avail. So before I throw the towel, I loaded the Arduino pro bootloader and attempted to upload a sketch for the last time. This time, I hit the reset switch just after pressing the upload button in the Arduino IDE, and it works! I should've done it earlier to save me some frustration but I guess its the price to pay for not doing the RTFM.

With Severino working, I can now continue being the Arduino late bloomer and share with you my experience programming arduino. I wont be risking the life of that shiny green Arduino Uno so you'll be seing severino for the rest of this thread.

What I am going to share here is not arranged according to complexity. It'll all depends on what I have worked on previously that I thought might be useful to my hobby. All information presented here are not guaranteed against error and should be treated as such. Corrections are very much welcome.

With that in mind, lets start with PWM. PWM or Pulse Width Modulation is simply defined as

Code: [Select]
(Pulse Width Modulation) A modulation technique that generates variable-width pulses to represent the amplitude of an analog input signal.
For us hobbyist, let us not dabble with the formulas. Ill save myself from trouble so Ill just introduce frequency and duty cycle here the way I understand it.

Code: [Select]
Frequency is the number of occurrences of a repeating event per unit time.
Code: [Select]
In engineering, the duty cycle of a machine or system is the time that it spends in an active state as a fraction of the total time under consideration.
(image taken from arduino website)



It is as simple as the illustration above. Frequency is how many times it cycle on/off in 1 second and duty cycle is how long it stays on during that cycle. PWM in arduino can be achieved by simply calling the analogWrite(pinNumber, dutyCycle) function. The default frequency is default to 500Hz so you have 2mS per on/off cycle. Duty cycle is expressed from 0 to 255, 255 being 100% duty cycle.

I have uploaded the sketch from the Examples menu of ArduinoIDE and here's what I got

Using LED



Using 4 x 1W LED



Notice the lines in the second video? It is the duty cycle working its magic. When the line is longer (higher duty cycle), the light becomes brighter, that means the pwm pin is high most of the time, causing the target to see more voltage from this pin, say at 75% duty cycle the target sees around 3.75V if the pins logic high is @5V. Its quite simple right? We can now control our mobots speed by applying pwm to the motor controller.

Thats all for today, good morning.


Philippine Electronics Forum


Offline danny

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 5491
  • Pogi/Ganda Points: 323
  • Gender: Male
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #1 on: November 29, 2011, 03:28:32 AM »
wow nice
ang galing naman nakakainis  ;D ;D ;D
danny

Philippine Electronics Forum

Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #1 on: November 29, 2011, 03:28:32 AM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3032
  • Pogi/Ganda Points: 208
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #2 on: November 29, 2011, 06:14:15 AM »
Set the log window of your IDE to verbose mode.  Then makikita mo when is the right time to press the reset switch.

Philippine Electronics Forum

Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #2 on: November 29, 2011, 06:14:15 AM »

Offline n0th1n6

  • Diesel Generator
  • *
  • Posts: 1986
  • Pogi/Ganda Points: 62
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #3 on: November 29, 2011, 07:10:10 AM »
^

I didnt do that :), as I've mentioned I seldom RTFM. Ill do that next time ], Thanks.

wow nice
ang galing naman nakakainis  ;D ;D ;D

Hahaha, i-program mo na si spy-trakr sir :)

Philippine Electronics Forum

Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #3 on: November 29, 2011, 07:10:10 AM »

Offline maldihtah13

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4669
  • Pogi/Ganda Points: 120
  • Gender: Female
  • Everyday is a learning process so try to learn ;D
    • Blogspot
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #4 on: November 29, 2011, 09:36:01 AM »
Nice

Philippine Electronics Forum

Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #4 on: November 29, 2011, 09:36:01 AM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3032
  • Pogi/Ganda Points: 208
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #5 on: November 29, 2011, 10:51:03 AM »
I didnt do that :), as I've mentioned I seldom RTFM. Ill do that next time ], Thanks.
It's also not in TFM,  lessons learned the hard way ...  Its good you still have'nt experienced precise timing when pressing the reset button.  Anyway, its only necessary when experimenting with different bootloaders using different serial speeds.

Offline Spammer-CSS

  • CR2032 Battery
  • **
  • Posts: 30
  • Pogi/Ganda Points: 11
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #6 on: November 29, 2011, 11:01:41 AM »
ang galing naman,...... ;)

Offline downloaderer

  • Size D Battery
  • ******
  • Posts: 267
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #7 on: January 01, 2012, 11:12:10 AM »
baket po sakin pinindot ko naman ung reset pin ayaw nyang gumana parin.. na try ko na before and after clicking the upload.. pano ba tamang procedure sa pag buburn neto after bootloading? atmega8L po gamit ko

Offline downloaderer

  • Size D Battery
  • ******
  • Posts: 267
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #8 on: January 01, 2012, 11:29:28 PM »
sha nga po pala ano po bang ibigsabihin pagka nagbliblink rapidly ung L LED every after 7-9 seconds? bale nangyare po yan after kong magbootload ng Atmega8 ung Arduino NG w/ Atmega8 po.. applicable din ba yan sa atmega8L atmega8 lang kase nakalagay eh.. d talaga ako makapagupload ng sketch.. pano po ba?

Offline downloaderer

  • Size D Battery
  • ******
  • Posts: 267
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #9 on: January 02, 2012, 03:59:51 PM »
natry ko narin po magloopback test pero ayaw parin po gumana saka bat ganun partial partial lang nakukuha sa loopback test.. ano kaya po prob neto help po please please

Offline marikit

  • LR44 Battery
  • *
  • Posts: 1
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #10 on: January 02, 2012, 08:17:59 PM »
Thanks for a very informative sharing.All the best!

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3032
  • Pogi/Ganda Points: 208
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #11 on: January 02, 2012, 08:50:06 PM »
sha nga po pala ano po bang ibigsabihin pagka nagbliblink rapidly ung L LED every after 7-9 seconds? bale nangyare po yan after kong magbootload ng Atmega8 ung Arduino NG w/ Atmega8 po.. applicable din ba yan sa atmega8L atmega8 lang kase nakalagay eh.. d talaga ako makapagupload ng sketch.. pano po ba?
Wait ka lang, hanapin ko yung optiboot for atmega8l na nakuha ko kay westfw, pinagkompile niya ako ng optiboot for atmega8, siya yata ang isa sa mga authors or nag-develop ng optiboot.  IIRC, nasa 115KBPS dapat ang serial speed mo, pero kung normal arduino, either nasa 19200 or 57600 dapat ang serial speed mo.

Offline downloaderer

  • Size D Battery
  • ******
  • Posts: 267
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #12 on: January 04, 2012, 09:42:13 AM »
Wait ka lang, hanapin ko yung optiboot for atmega8l na nakuha ko kay westfw, pinagkompile niya ako ng optiboot for atmega8, siya yata ang isa sa mga authors or nag-develop ng optiboot.  IIRC, nasa 115KBPS dapat ang serial speed mo, pero kung normal arduino, either nasa 19200 or 57600 dapat ang serial speed mo.

optiboot? ano po yan? hex file para sa Atmega8L? eto po pala update d ko sure kung gumagana na o hnde pero nung nagupload ako ng sketch shempre pressing reset also ok mukhang gumagana pero me protocol something error padin hindi na sha ung resp = 0x00.. kung nakakapagupload na sha bat me error padin? wierd..

Offline n0th1n6

  • Diesel Generator
  • *
  • Posts: 1986
  • Pogi/Ganda Points: 62
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #13 on: January 04, 2012, 10:24:08 AM »
It will be easier if you at least post a picture of the error you encounter. That can save us lots of time suggesting solution for the wrong problem.

Offline downloaderer

  • Size D Battery
  • ******
  • Posts: 267
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #14 on: January 04, 2012, 10:33:59 AM »
Quote

avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x14
avrdude: stk500_cmd(): programmer is out of sync


yan po ung error nagtry ako ng different delays dun sa blinking for testing mukha naman shang nguupload baket ganun? saka talagang kelangan ihold ung reset bago magupload palagi? kala ko 1 beses lang pde gawin un.. parang d pala gumagana ung auto reset

Offline n0th1n6

  • Diesel Generator
  • *
  • Posts: 1986
  • Pogi/Ganda Points: 62
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #15 on: January 04, 2012, 10:42:14 AM »
yan po ung error nagtry ako ng different delays dun sa blinking for testing mukha naman shang nguupload baket ganun? saka talagang kelangan ihold ung reset bago magupload palagi? kala ko 1 beses lang pde gawin un.. parang d pala gumagana ung auto reset

Kapag ganyan ang error, hindi yan naga-upload. Maraming ibig sabihin yang error na yan eh. Matanong ko, nakapag upload ka na ba ng boot loader? Kung nakapag upload ka, dapat yung LED sa pin 13 ay magbi blink yun.

Baka naman sinusubukan mo mag upload ng sketch pero yung target na arduino board mo eh wala pang boot loader.

Offline downloaderer

  • Size D Battery
  • ******
  • Posts: 267
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #16 on: January 04, 2012, 11:22:29 AM »
ay
Kapag ganyan ang error, hindi yan naga-upload. Maraming ibig sabihin yang error na yan eh. Matanong ko, nakapag upload ka na ba ng boot loader? Kung nakapag upload ka, dapat yung LED sa pin 13 ay magbi blink yun.

Baka naman sinusubukan mo mag upload ng sketch pero yung target na arduino board mo eh wala pang boot loader.

opo ngbootload na po ako.. ok na po pala me nakalas lang palang sulda kaya pala ganun hehe.. sya nga po pala talagang every time na maguupload kelangan talagang ihold ung reset saka bibitawan paglumabas ung binary sketch blah blah kahit nakakabit ung auto reset?

Offline 1diyMARKET

  • Lead Acid Battery
  • *******
  • Posts: 545
  • Pogi/Ganda Points: 4
    • 1 am 1diyTEAM
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #17 on: January 05, 2012, 10:16:17 AM »
ay
opo ngbootload na po ako.. ok na po pala me nakalas lang palang sulda kaya pala ganun hehe.. sya nga po pala talagang every time na maguupload kelangan talagang ihold ung reset saka bibitawan paglumabas ung binary sketch blah blah kahit nakakabit ung auto reset?

Parang hindi....  ano pa gamit ng auto reset kung may manual pindot naman?
Your Support and Purchase of 1diycentre e’store products is a support to our fellow  hobbyist.  Most of the buyers here at e’store are students who do not have yet source of income.  1diyteam offer monthly payment to some items to help our fellow hobbyist.

Offline n0th1n6

  • Diesel Generator
  • *
  • Posts: 1986
  • Pogi/Ganda Points: 62
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #18 on: January 05, 2012, 11:09:29 AM »
Parang hindi....  ano pa gamit ng auto reset kung may manual pindot naman?

Dapat nga hindi na kelangan ang button kung auto reset na. But I suspect na yung mga USB-Serial cable ang culprit dito. Mukhang kulang ang binibigay nya sa base ng transistor kaya di nati trigger yung reset.

Offline kaweters

  • CR2032 Battery
  • **
  • Posts: 11
  • Pogi/Ganda Points: 0
Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #19 on: January 10, 2012, 11:18:03 PM »
pano po kapag ikabit ung bluetooth shield from egizmo... dun sa arduino uno.... pano po ang pagprogram...

Philippine Electronics Forum

Re: Arduino - Sharing my experience programming the arduino as a hobbyist
« Reply #19 on: January 10, 2012, 11:18:03 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com