technolando

Inserisci la tua mail per essere sempre aggiornato:




Costruire un Robot con Arduino

Etichette: ,

Inviato da technolando tramite Google Reader:

tramite ArduinoFun.com Blog di Administrator il 30/12/09
Arduino Start Here Robot

Arduino Start Here Robot

Contest entry by Dane Edmonds. This is my first robot using Arduino , it uses a l239d motor driver and is basically my attempt at making a "start here" robot.

This is my first time using Arduino so I decided to build a robot that would help me learn arduino's code , I wanted to start small and build up to harder things so I made the robot expandable , as I get better with coding I will add more things . So I hope other people who are new to arduino can learn from this robot to

Dane says: Arduino has meant a cheap and easy to use micro controller, giving people a chance to achieve their goals and has helped make school holidays less boring for me .

YouTube Video Available Here.

Parts list :

Things you can add :

Build It! instructions:

  • 1) cut thin scrap wood (about 8 millimeters thick) in to 2 squares of 13.5 cm x 13.5 cm
  • 2) in one of the squares cut hole the same size as your servo base , about 1cm from one of the edges .
  • 3) paint desired colour
  • 4) using a hot glue gun glue the motors in place (as shown in top picture), with some small screws ,screw in the Arduino to the breadboard will have adhesive tape on the back, peel of plastic and stick in place.
  • 5) using this walk through set up your motor controller http://letsmakerobots.com/node/2074
  • 6) drill 2 holes in the back corners of the wood to fit your spacers and one above the Arduino (do the same for the 2nd piece of wood .
  • 7) put your servo in place , and screw into wood
  • 8) made a pan/tilt system with a bit of scrap metal , (you can do the same if you wish but is not needed )
  • 9) screw in your infrared sensers(as shown below) attach header pins (look on the sensor connect VIN and GND to the bread board power lines and OUT to a digital pin on your arduino.

Arduino Sketch

const int infra=3;   const int infra2=4;      void setup()   {      Serial.begin(9600); pinMode(13,OUTPUT); pinMode(12,OUTPUT); pinMode (11,OUTPUT); pinMode (10,OUTPUT); pinMode (infra,INPUT); pinMode (infra2,INPUT);   }    void loop()    { if (digitalRead(infra)== HIGH) {         driveforward();        }          if(digitalRead(infra) == LOW)     {           stopmot();          delay (500);          reverse();          delay (500);          right();          delay (2000);      }             else if (digitalRead(infra2)== LOW)        { stopmot();          delay (500);          reverse();          delay (500);          left();          delay (2000);        }              }                 void driveforward()   {   digitalWrite(13,HIGH);     digitalWrite(10,HIGH);     digitalWrite (11,LOW);     digitalWrite (12,LOW);   }    void stopmot()   {      digitalWrite(13,LOW);     digitalWrite(12,LOW);     digitalWrite(11,LOW);     digitalWrite(10,LOW);   }   void reverse()   {     digitalWrite(12,HIGH);     digitalWrite(11,HIGH);     digitalWrite (13,LOW);     digitalWrite (10,LOW);   }    void right()   {     digitalWrite (10,HIGH);     digitalWrite (13,LOW);     digitalWrite (12,LOW);     digitalWrite (11,LOW);   }    void left()   {     digitalWrite (13,HIGH);     digitalWrite (11,LOW);     digitalWrite  (12,LOW);     digitalWrite (10,LOW);  }
Share/Bookmark

Operazioni consentite da qui:

Leggi il resto dell'articolo...



Se ti è piaciuto l'articolo, iscriviti al feed per tenerti sempre aggiornato sui nuovi contenuti del blog! Se invece vorresti vedere pubblicato un articolo in particolare mandami una richiesta





Costruir una radio WiFi

Etichette: , ,

Inviato da technolando tramite Google Reader:

tramite Electronics-Lab.com Blog di admin il 19/01/10

Inspired by Jeff Keyzer, Gary Dion decided to build his own WiFi radio. He constructed it using an Asus WL-520gu wireless router, an old USB audio headset, and a bunch of spare parts from his junk pile. After following Jeff's directions to get the basic radio working, he added some extra niceties such as an infrared remote! [via]

Nice WiFi radio build - [Link]


Operazioni consentite da qui:

Leggi il resto dell'articolo...



Se ti è piaciuto l'articolo, iscriviti al feed per tenerti sempre aggiornato sui nuovi contenuti del blog! Se invece vorresti vedere pubblicato un articolo in particolare mandami una richiesta





Generare elettricità con una candela e una cella di peltier

Etichette: ,

Inviato da technolando tramite Google Reader:

tramite Hack a Day di Mike Szczys il 05/01/10

What you see above is a generator that converts heat to electricity. [Reukpower's] thermoelectric lamp is one of those hacks that makes you scratch your head even though you understand why it should work. The heart of the system uses a Peltier cool, just like the thermoelectric solar generator. When there is a temperature differential from one side of the Peltier to the other a small current is generated.

In this case a candle heats one side and a heat sink cools the other. The tiny voltage picked up from the Peltier's contacts is then boosted using a joule thief. We've seen LEDs powered with a joule thief before, benefiting from their own low power consumption. In this case, the boost circuit is scavenged from an emergency phone charger and probably achieves higher efficiency than if he had built it himself.


Operazioni consentite da qui:

Leggi il resto dell'articolo...



Se ti è piaciuto l'articolo, iscriviti al feed per tenerti sempre aggiornato sui nuovi contenuti del blog! Se invece vorresti vedere pubblicato un articolo in particolare mandami una richiesta





Labirinto con Arduino

Etichette: ,

Inviato da technolando tramite Google Reader:

tramite ArduinoFun.com Blog di Administrator il 31/12/09

Contest Entry by Joe Cochran
In another project, I created a way to control a 8×8 RGB Matrix using an Atari Joystick. While waiting for one of the components to arrive, I had an idea that a maze could be constructed on the RGB Matrix and a user could go through the maze with a joystick.

Most maze algorithms assume that the maze can have "paper-thin" walls. That is, that the occupiable spaces don't occupy the same amount of space as the walls. However, with the RGB Matrix the walls have to be represented by a whole LED being turned on. So in essence each LED is marked as a "wall" or as an "occupiable space"
Joe has created a page that contains the detailed instructions on how to create your own JoyLite Maze. I am posting the link to it, rather than recreating it all again.

JoyLite Maze "How To".

Joe Says:Arduino has been a fantastic opportunity to for me rediscover the creative process. I became a software developer because I get a lot of satisfaction from turning an idea into reality. When you get down to it though, professional software development ends up being little more than manipulating some bits in databases and RAM. Nothing tangible. Arduino has allowed me to move beyond the "cyberspace" and into the "real world", opening the door to physical computing with motors, switches, lights and dials. And while I may be short on knowledge in regards to the electrical and mechanical engineering aspects of these projects, the Arduino community is so healthy, friendly and capable that they help make learning this stuff a real treat too.
Share/Bookmark

Operazioni consentite da qui:

Leggi il resto dell'articolo...



Se ti è piaciuto l'articolo, iscriviti al feed per tenerti sempre aggiornato sui nuovi contenuti del blog! Se invece vorresti vedere pubblicato un articolo in particolare mandami una richiesta





Giochi con Arduino

Etichette: ,

Inviato da technolando tramite Google Reader:

tramite Liquidware Antipasto di Matt il 15/01/10
What would you get if you crossed 7 minute abs with DIY and Open Source and a retro gaming tutorial? I don't know, but it sounded a lot better when Chris and I were talking about project ideas last week... we were reminiscing about how in middle school I bought a bunch of books filled with hollow promises that claimed to be able to teach game programming in 1 hour, 12 minutes and 22 seconds. Flat. No one ever learns game programming this way.

I think you learn game programming by taking something open source, and tweaking the settings around until you get more and more comfortable with the concepts. I like to think this is like physical computing meets programming. I learn a lot better by taking apart than by building, so this guide is intentionally written backwards. Instead of building from the "ground up," by learning all the painful parts of programming slooooowly, the steps are written by getting quickly to the end, and then "tearing it apart top down" like the way a reverse engineering hacker would think about it. I don't know, I just think better that way. Maybe I don't have the attention span to write line by line of code following a 500 page book. Thiiiiiiiis iiiiiiis hooooow yoooou maaaake an intttttteeeeggggerrrrrrr hellllllllloooooooo wooooooorrrrlllllllddddd (like whale speak from Finding Nemo).

So here goes my annotated tutorial on how to build your own DIY Handheld Asteroids Game.

Here's a little video and picture of the finished product:







Step 1: Assemble the Hardware

The nice thing about Arduino's, are that they interface to just about anything. You can make buttons out a pieces of wire, potentiometers, or whatever. Sometimes, you just want something quick and dirty, other times you want lots of features. I like features. So I used a Arduino GamePack for this project:
I could also use the MegaPalm (which is like the GamePack but uses the Arduino Mega instead):
For the sake of simplicity, the code samples and such are going to use these parts. But once you get the hang of it, the circuit could easily be adapted to use any other open source hardware you wanted, naturally...


Step 2: Get everything up and running

Connect the hardware together to make the physical device. In this case, that means connecting the Arduino and Lithium Backpack to the backside of the ExtenderShield, and then popping the TouchShield Slide and InputShield onto the top of the ExtenderShield.

What do all the parts do?
The game code runs on the TouchShield Slide. The TouchShield is like a graphics card and display for Arduino-based gadgets. It runs a small program that is written in the Processing graphics programming language.
The InputShield has a joystick and some buttons. When you press them, they shield changes the digital and analog pins on the bottom of the shield to different values, so you can read them with an Arduino and tell which direction the joystick is pointing, and which buttons are being pressed.
The Arduino constantly polls and reads the joystick and button's values, and determines which direction the joystick is being pressed or which buttons are being held.
The ExtenderShield connects the Arduino, TouchShield, and InputShield together. It replicates the pins so you can connect the shields together.
The Lithium Backpack provides power to the gadget so that it's portable.

How to program it?
Make sure you have the latest version of the Antipasto Arduino IDE for Windows or Mac (email me for linux), which is downloadable from the Open Source app store.
Use File menu -> New Gadget, name the gadget "Asteroids", and then click save:
The gadget file let's you program different Arduino shields and modules at the same time quickly, all in one place. It's a branch of the main Arduino IDE. Now, add the Arduino module and the TouchShield module by clicking the plus sign in the pop-out drawer on the left side:
Click the Arduino, and then copy and paste this code, and program it to the Arduino:


#include <afsoftserial.h>
#include <inputshield.h>

#define RX_PIN 3 /* TouchShield's Tx Pin */
#define TX_PIN 2 /* TouchShield's Rx Pin */

/* Create a serial connection to the TouchShield */
AFSoftSerial mySerial = AFSoftSerial(RX_PIN, TX_PIN);

/* Create InputShield on modes A and pass it software serial */
InputShield inputShield = InputShield(0, mySerial);

void setup() {
}

void loop() {
inputShield.SendHardwareState(mySerial);

delay(100);
}


Then, click the TouchShield icon on the left, and copy and paste the code in the file called "MegaAsteroids_TouchShield_Code.txt" in the file downloadable here, and program it to the TouchShield Slide:
Then turn the power on and off to the GamePack by flipping the power switch on the Lithium Backpack, and the game is up and running...



Step 3: Tear the code down into its main parts

Ok. Clearly, all the fun happens in the TouchShield Slide code section, and it's written in Processing. If you're not familiar with Processing, here's a great overview of all the graphics functions available. Mark has pretty systematically ported almost all of the graphics functions onto the TouchShield...

So the code has a few major functions that matter:

gameLoop() - the function that updates and draws the ship, bullets and asteroids on the screen. It just calls other functions that do all the work, and just sits around looping, hence the name "loop".
readInputShield() - this function grabs all the code from the Arduino and InputShield. You don't have to worry about this one, it just works.
setup() - configure the background of the screen.

updateAsteroid() - a psycho-crazy function that updates all the asteroids' locations based on their locations.
drawAsteroid() - actually draw the asteroids, drawing all of them

updateShip() - a cool function that updates the ship, and takes into account which way it's facing, and which way it should turn based on values from the InputShield
drawShip() - this function actually draws the ship

updateBullets() - a function to update the position and location of the bullets that shoot at the asteroids.
drawBullets() - a simple little that erases old bullets and draws new ones elsewhere

There are 3 main things in the Asteroids game: asteroids (duh), a ship (naturally), and bullets (a lot of people forget that these are their own thing). Each has a function to update the position, and draw or update the drawing of each.

If you're just starting out, each of these functions might be a little over your head. In my opinion, that's at least a lot better than being placated with stupid little hello world programs that leave you scratching your head wondering, "great, why did I buy this book again?"


Step 4: Find the Important Pieces of Code

The trick to learning how to change code's behavior is actually first in learning where to spot the fun parts of the code. Great programmers (e.g. not me) that I know can just pop open a massive source code file, and skim through it and immediately know where all the cool functions and critical variables are going to be. It's almost like a 6th sense.

Where are the cool parts of code that are going to help you change the behavior? Here are some..

This is the header section, where global variables get defined - it's usually at the top:

This code initializes the asteroids and sets how they are:
This is the collision code that checks for whether the asteroid got hit by a bullet:
Here's the code that draws the ship:
...and the asteroids:
This code makes the asteroid wrap around the screen:

Step 5: Change the behavior of the game

Once you've figured out the cool parts of the code, now you're ready to change the behavior of little parts of the program, one at a time. Every time you change a feature, you get more and more comfortable with how the game works. Change the feature, recompile the code, send it down to the TouchShield, and see how it affects the game play.

For instance, kMaxAsteroids is the maximum number of asteroids to have in the game. It's currently set to 10. What happens if you set if to 5? Or 7?

What if you change the width to 40, and height to 10?
Now, let's do comparisons. This code checks for what happens when a bullet is within the bounds of the box formed by the asteroid. The part that matters is the if ((L->X > aBounds->left... part:
Try deleting or commenting out all the code from everything inside the if statement, like so:

//aSize->width -= 5;
//aSize-%gt;height -= 5;
//score += 50;

Now, when you shoot an asteroid, nothing happens. Ok, now for some fun, put those lines back in, but this time, change them to += 5 instead of -= 5:

aSize->width += 5;
aSize-%gt;height += 5;
score += 50;

Now, when you shoot the asteroids, they get bigger, not smaller... ok, you just learned variable setting and comparisons, and incrementors, and all kinds of stuff that has long names that don't matter as long as you know how to change the size of asteroids now :-)

Now, try changing the color of the ship. Instead of stroke(255), which is white, make it stroke(255,0,0), which is red:

You can do the same thing here, too, and the color of the asteroids could be changed to stroke(0,0,255) to make them blue.
Finally, here's the code again for the asteroid wrap-around-the-screen effect:
Instead of making the asteroid wrap, make it adopt a new random direction, which will make asteroids freak out every time they hit the edge of the screen (which is fun).

Replace:

L->x = 0;

with:

a[x].rotation = random(50,130);

...and replace:

L->x = 320;

with:

a[x].rotation = random(50,130);



Step 6: Build your first cheat code patch!

Let's be realistic. The real reason anyone first learns how to program is to hack their favorite game so they can get a higher score and be "that guy" in math class and at lunch with the highest score. Anyway, this may be the first official ARDUINO CHEAT CODEZ!!!!111 ever. This is a proud day for all Arduino hackers...

See that little line there that says score += 50. What happens if you change it to 5,173 instead of 50. Why 5,173, you ask? Because if you set the score incrementer to a big whole number like 5,000, it'll be obvious as you're playing that you're cheating the score. But if you make it a fancy number like 5,173, no one will notice, and it'll look like your score is going up naturally, just really fast. Clever :-)


Conclusion

So there you have it. An Open Source Asteroids game for the Arduino, written in Processing, and a short tutorial that teaches game hacking. This is the guide I wish someone had written for me when I was first learning programming. All I wanted was a step by step guide for how to hack games, and play around with them.

Arduino TouchShield Slide Asteroids from Matt Bitz on Vimeo.



Operazioni consentite da qui:

Leggi il resto dell'articolo...



Se ti è piaciuto l'articolo, iscriviti al feed per tenerti sempre aggiornato sui nuovi contenuti del blog! Se invece vorresti vedere pubblicato un articolo in particolare mandami una richiesta





Mini Hexapod Walker Robot

Etichette: , ,

Inviato da technolando tramite Google Reader:

tramite Hacked Gadgets - DIY Tech Blog di Alan Parekh il 16/01/10

pololu_hexapod


This tiny Hexapod Walker costs only about $70 to build. It is based around the Micro Maestro 6-channel USB Servo Controller by Palolu. It only takes three servos and some paperclip legs to get this thing in motion and with a few distance sensors for eyes it can see obstacles and get around them.

Thanks for the tip Paul.

"This tutorial shows you how to build a very simple autonomous hexapod robot using just three servos. The 2″-high hexapod is capable of walking forward and backward, and can turn left and right. Two forward-looking distance sensors provide obstacle avoidance. The brain of the hexapod is the Pololu Micro Maestro, a 6-servo controller that can read inputs and play motion sequences in a stored script."



Operazioni consentite da qui:

Leggi il resto dell'articolo...



Se ti è piaciuto l'articolo, iscriviti al feed per tenerti sempre aggiornato sui nuovi contenuti del blog! Se invece vorresti vedere pubblicato un articolo in particolare mandami una richiesta





Arduino Powered Helicopter with Four Rotors

Etichette: ,

Inviato da technolando tramite Google Reader:

tramite HacknMod.com - You name it. We hack it. di Joe L il 15/01/10


We've seen loads of superb Arduino projects, but few which involve complex aeronautics. Here we have the "quadrocopter" – an arduino powered, remote control helicopter with four rotor blades. It's a superb build overall with the finished prototype fitting inside a pretty small package. Source code and full docs are available.

Besides this quadrocopter, you can also build an "AeroQuad" using similar aerodynamic principles.

Popular Airplane & Copter Posts:


Operazioni consentite da qui:

Leggi il resto dell'articolo...



Se ti è piaciuto l'articolo, iscriviti al feed per tenerti sempre aggiornato sui nuovi contenuti del blog! Se invece vorresti vedere pubblicato un articolo in particolare mandami una richiesta