Arduino Examples etc for the first kit

Using and Programming Arduino and other microcontrollers
phenoptix
Competent
PostsCOLON 744
JoinedCOLON Sat Apr 17, 2010 11:25 am

Arduino Examples etc for the first kit

Postby phenoptix » Tue Sep 27, 2011 3:23 pm

Just having an afternoon of Arduino play and thought I'd collate my experiences and the sketches (that's what they call programs in Arduino) in one place. For now that's here!

One of the uses we have in store for arduino is to cut down on the menial tasks we have to do to make electronics kits, recreating oomlout's RECO is a prime priority so we thought we'd first learn how to use servos and motors.

Servos are easiest as they're low power and can be run directly from the board using a single pin. We also used a potentiometer on another pin to allow control. The sketch we used is

CodeColon Select all

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
void loop()
{
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}


The code and the board layout can be found here: http://arduino.cc/en/Tutorial/Knob

I have some video of the results and for something that is so simple it is rather cool!

bigal344
Competent
PostsCOLON 426
JoinedCOLON Thu Jun 09, 2011 11:21 pm
LocationCOLON Crewkerne,Somerset

Re: Arduino Examples etc for the first kit

Postby bigal344 » Tue Sep 27, 2011 11:16 pm

I think after reading the recommended arduino book, i've found that what you have mentioned about making more complex and repetitive tasks into simple sub-routines using the 'sketches', is one of the main thing that appeals to me.
I have a reasonable knowledge of alot of things electronic, but i've found that having that info in my head and actually being able to piece it all together to do a seemingly simple task with say a LED or motor it another thing all together, and as for finding out what you've done wrong when it doesn't work..... :(
Arduino looks like it will allow for much more fun experimentation using simple circuits and tweaking your sketches to alter the outputs and how they are affected by whatever inputs you are using.
Looked up the oomlout RECO, just because i had to see what the hell it was, http://oomlout.co.uk/?p=315, and its another good example of a simple task carried out by something that you can make yourself! How cool is that!
Image

Today I have been mostly Nyaning.

phenoptix
Competent
PostsCOLON 744
JoinedCOLON Sat Apr 17, 2010 11:25 am

Re: Arduino Examples etc for the first kit

Postby phenoptix » Wed Sep 28, 2011 7:14 am

Within another 10 minutes I managed to get a stepper motor working, so that's all the electronics needed for the RECO mk 0.2, I've decided mine will probably be a step back from the original so haven't named it as an upgrade! Hopefully will be getting the main resistor moving wheel cut at our Hackspace via "laser". Want a 10cm circumference (=20 resistors) so have to be fairly exact with the measurements. Most standard sized hole saws are based on diameter rather than circumference!

There's a couple of pictures and a video on my G+ feed, I'll try and get them on here asap, however most bits and bobs will appear there first as my HTC flyer uploads to G+ automatically, which is rather handy! I'm Ben Gray on G+ the description should give away which one is me if there's more than one now it's getting more popular.

You'll be amazed at how simple arduino is once you get hold of a board Al, I'd say you were on our experimentation team really so you'll get a freebie! Once the kit is together I'm going to do a little launch give away but I want the kit tested out first! I may have the boards by the end of the week as they're with UPS in Madrid at the moment, the rest of the kit will be later but there's tonnes you can do with LEDs and other bits and bobs before the bread boards, jumpers etc turn up.

bigal344
Competent
PostsCOLON 426
JoinedCOLON Thu Jun 09, 2011 11:21 pm
LocationCOLON Crewkerne,Somerset

Re: Arduino Examples etc for the first kit

Postby bigal344 » Thu Sep 29, 2011 5:58 pm

Really looking forward to making a start with arduino now, i have a general question though after reading the book and the whole premise of hacking, i'm after suggestions of household appliances/toys that i can pick up cheap and destroy for bits.
Maybe and old VCR, possibility of drive motors, sensors and maybe servos?
I can think of a few toys, but i don't think the kids would appreciate me pulling them apart!!!
What i'm planning is ebay trawling for old broken stuff, that i can pull apart and hack. Like i say the book has some ace ideas, like using the membrane from an old keyboard triggered by a PIR/motion sensor to hit random keys!!!!
Image

Today I have been mostly Nyaning.

phenoptix
Competent
PostsCOLON 744
JoinedCOLON Sat Apr 17, 2010 11:25 am

Re: Arduino Examples etc for the first kit

Postby phenoptix » Thu Sep 29, 2011 7:42 pm

Just looking at the xbox controller you have two nice little motors, two double potentiometers with a tact switch (which I'm eyeing up for colour changing LED control), I assume the triggers are also potentiometers. It's not something I've done much of before but I can see it's going to become addictive too!

bigal344
Competent
PostsCOLON 426
JoinedCOLON Thu Jun 09, 2011 11:21 pm
LocationCOLON Crewkerne,Somerset

Re: Arduino Examples etc for the first kit

Postby bigal344 » Thu Sep 29, 2011 8:37 pm

That is very true, and although its more than likely way outside my limits at the moment i can already see some excellent potential ideas for using those xbox sticks as analog inputs for controlling motors/etc for movement or sounds etc, i'm thinking about using various toys here maybe, hmmmm. 8-)
Image

Today I have been mostly Nyaning.

bigal344
Competent
PostsCOLON 426
JoinedCOLON Thu Jun 09, 2011 11:21 pm
LocationCOLON Crewkerne,Somerset

Re: Arduino Examples etc for the first kit

Postby bigal344 » Sat Oct 01, 2011 1:31 am

Its here!!!!!
Found a suitable USB lead, downloading arduino programs, unfortunatly my youngest is quite ill and for the first time wants nothing but 'daddy'!!!
So no time today, howevr i've brought home all my wires, resistors and LEDs, so i may get to play over the weekend!!! :D
Image

Today I have been mostly Nyaning.

phenoptix
Competent
PostsCOLON 744
JoinedCOLON Sat Apr 17, 2010 11:25 am

Re: Arduino Examples etc for the first kit

Postby phenoptix » Sat Oct 01, 2011 11:57 am

Nothing quite like playing nurse eh? Hope the little un recovers quickly!
Those arduinos are addictive little buggers so beware!

bigal344
Competent
PostsCOLON 426
JoinedCOLON Thu Jun 09, 2011 11:21 pm
LocationCOLON Crewkerne,Somerset

Re: Arduino Examples etc for the first kit

Postby bigal344 » Sat Oct 01, 2011 2:36 pm

She's getting better, as long as she keeps taking the Calpol!!
I've got the most basic LED flashing program and have been messing about with the timings and output pins, just to get used to it.
If i'm allowed, i may start with a few basic sensors.
By the way i found a spare xbox analogue stick and messed the resistances, there are three pins on each axis, central negative and two extremes that raise the resistance when operated if i remember correctly, although i think it'll be awhile untill i start messing with them!!
Are you gonna be stocking any breadboards?
Image

Today I have been mostly Nyaning.

phenoptix
Competent
PostsCOLON 744
JoinedCOLON Sat Apr 17, 2010 11:25 am

Re: Arduino Examples etc for the first kit

Postby phenoptix » Thu Oct 06, 2011 7:32 pm

Saw your handy work on G+! Very nice. Breadboards are ordered and paid for just waiting for the Chinese national holiday to be over so they ship. Both the 400 point small ones that are a similar size to the uno and the larger 840 pin project boards. Also got 75pcs jumper sets, some mini servos and pin headers in the same order. The servos are fantastic! Already have tonnes of tact switches for the kits, as well as a plethora of LEDs (of course) will also try and find some fun sensors to ship with them too. Trust the little un is mended!


Return to

Who is online

Users browsing this forum: 1 and 0 guests