menu alto

  • PUBBLICITA’ CONTATTI
HobbyMedia HobbyMedia News di Modellismo dinamico e statico
Home

Navigazione

  • NEWS DI MODELLISMO
  • TECNICA RC
  • TAMIYA
  • TRAXXAS
  • LEGO
  • COMPETIZIONI
  • PISTE RC
  • ENGLISH 🇺🇸
Return to Content


Easy Arduino Robot – Modellismo e robotica amatoriale

07 Lug 2009

Di Frankie - arduino, Robot

ArduinoFan, un utente del sito Let’s Make Robots ha postato un progetto per realizzare un semplice quanto divertente robot utilizzando la scheda Arduino.  Si può vedere come il telaio del robot si basa su una basetta breadboard su cui sono attaccati i servi, l’Arduino e le altre parti tramite edel nastro biadesivo spesso (con supporto in schiuma acrilica) e delle fascette autobloccanti di plastica. OK, no nsarà come Wall-e ma ci sembra un ottimo progetto per i modellistici che vogliono avvicinarsi alla robotica e all’utilizzo di Arduino.

Puoi trovare le informazioni per il montaggio qui.

Materiali utilizzati:
(1) Arduino
(2) Continuous Rotation Servos
(1) Standard Servo
(1) Box per 4 batterie AA
(4) AA Batterie
(1) 1-1/4″ Caster Wheel
(2) Servo Mountable Wheels
(1) Sharp IR Sensor
(1) IR Sensor Servo Mount
(1) Breadboard da 840 contatti
Filo elettrico
Fascette autobloccanti
Nastro biadesivo

100_0889

Ecco il coide da caricare su Arduino per gestire i servi.

Shawn – http://www.ArduinoFun.com
Arduino Sketch:
/*
* Brian Bailey *
* Drives servo robot and avoids obsticles using Sharp IR range finder
* http://bunedoggle.com/robots.php
*/

#define CENTER 1400
#define CENTER_R CENTER
#define CENTER_L CENTER+1

#define LEFT CENTER-650
#define RIGHT CENTER+650

#define R_FULL_FORWARD R_STOP+300
#define L_FULL_FORWARD L_STOP-300
#define L_FULL_REVERSE R_FULL_FORWARD
#define R_FULL_REVERSE L_FULL_FORWARD
#define R_STOP 1450
#define L_STOP 1450

#define LEFT_TURN 0
#define RIGHT_TURN 1
#define QUARTER_TURN_DELAY 800 // in milliseconds

#define DIST_ERR 50

#define RSPEED R_STOP + 100
#define LSPEED L_STOP – 110

#define DEBUG 0

#define BUMP_DELAY 125

int leftDist = 0; // the average
int rightDist = 0;
int forDist = 0;
int vision = 5;
boolean goingLeft = true;
boolean turnNow = false;

int curDist = 0;
int objDist = 0;
int objDir = 0;

#include .h>

// create servo objects to control servos
ServoTimer2 leftWheel;
ServoTimer2 rightWheel;
ServoTimer2 head;

int leftSpeed = LSPEED; // variable to store the servo position
int rightSpeed = RSPEED;
int headPos=CENTER;

void setup()
{
leftWheel.attach(10); // attaches the servo on pin 9 to the servo object
rightWheel.attach(11);
head.attach(9);

rightWheel.write(rightSpeed); // Stop Wheels
leftWheel.write(leftSpeed); // Stop Wheels
head.write(headPos);

Serial.begin(9600); // initialize serial communication with computer
}

/*******************************************************
* turn – Executes an in-place turn for miliseconds
* QUARTER_TURN_DELAY gets you about 90 deg
********************************************************/
void turn(int dir, int duration){
// Store previous speeds
//rightSpeed = rightWheel.read();
//leftSpeed = leftWheel.read();

if(dir == LEFT_TURN){
rightWheel.write(R_FULL_REVERSE);
leftWheel.write(L_FULL_FORWARD);
}
else {
rightWheel.write(R_FULL_FORWARD);
leftWheel.write(L_FULL_REVERSE);
}
delay(duration);

// restore previous speeds
rightWheel.write(rightSpeed);
leftWheel.write(leftSpeed);
}

void go(){
rightWheel.write(RSPEED);
leftWheel.write(LSPEED);
}

void stop(){
rightWheel.write(R_STOP);
leftWheel.write(L_STOP);
}

/***************************************************
* scan – This function is called every cycle
* it turns the head a click and records a distance and
* heading. It only saves the closest object info.
* objDist and objDir hold the closest object data
****************************************************/
void scan(){

if(goingLeft){
head.write(head.read()-10);
}
else{
head.write(head.read()+10);
}

if(head.read() <= LEFT){
goingLeft = false;
forDist = 0;
objDist = 0;
turnNow = true;
}

if(head.read() >= RIGHT){
goingLeft = true;
forDist = 0;
objDist = 0;
turnNow = true;
}

curDist = analogRead(vision);
if(curDist > objDist){
objDist = curDist;
objDir = head.read();
if(DEBUG){
Serial.print(”New close obj at Dist: “);
Serial.print(objDist);
Serial.print(” heading: “);
Serial.println(objDir);
}
}

delay(10);

}

/**********************************************************
* bump
* Executes a nudge to a given side
* Pass in LEFT_TURN or RIGHT_TURN
***********************************************************/
void bump(int dir){
#define BUMP 100
if(dir == LEFT_TURN){
rightWheel.write(rightWheel.read()-BUMP);
delay(BUMP_DELAY);
rightWheel.write(rightWheel.read()+BUMP);
}
else {
leftWheel.write(leftWheel.read()+BUMP);
delay(BUMP_DELAY);
leftWheel.write(leftWheel.read()-BUMP);
}
}

/**********************************************************
* bumpSteer
* Nudges us back on coarse if we see something off to the
* side. Relies on objDist and objDir to be updated by scan()
*
***********************************************************/
void bumpSteer(){
// One bump per scan
if(!turnNow || objDist < 470)
return;

if(objDir > CENTER){
bump(RIGHT_TURN);
}
else if(objDir <= CENTER){
bump(LEFT_TURN);
}
// No turn till next scan
turnNow = false;
}

void lookAround(){
head.write(LEFT);
delay(400);
leftDist = analogRead(vision);
head.write(CENTER);
delay(400);
forDist = analogRead(vision);
head.write(RIGHT);
delay(400);
rightDist = analogRead(vision);
head.write(CENTER);
delay(200);
}

int cornerNav(){
if(objDist > 600 && objDir > CENTER – 350 && objDir < CENTER + 200){

if( DEBUG ){
Serial.println(“Check:”);
Serial.println(objDist);
Serial.println(objDir);
}

stop();
lookAround();
if(leftDist > rightDist + DIST_ERR){
turn(LEFT_TURN, QUARTER_TURN_DELAY);
}
else {
turn(RIGHT_TURN, QUARTER_TURN_DELAY);
}
go();
objDist = 0;
return 1;
}
return 0;
}

void loop()
{

scan();
if(!cornerNav()){
bumpSteer();
}

}

CORALLY // Radiosistemi

Un commento su Easy Arduino Robot – Modellismo e robotica amatoriale

  1. barattarli 16 dicembre 2015 at 10:13 #

    Veramente un eccellentepost. Leggo con interesse il blog http://www.hobbymedia.it. Avanti con questa grinta!

    leggi questo articolo

    Rispondi

Lascia un commento Click here to cancel reply.

Articoli che potrebbero interessarti

  • JEEG: Costruisci il tuo Robot - Il Modellismo a fascicoli torna in edicola!JEEG: Costruisci il tuo Robot -…
  • Mazinger Z e Jeeg Robot si scontrano in edicola con le rispettive raccolte a fascicoli di modellismo!Mazinger Z e Jeeg Robot si…
  • Mazinga Z: Costruisci il mitico robot Mazinger con i fascicoli Hachette - Il modellismo giapponese in edicolaMazinga Z: Costruisci il mitico…
  • Sega entra nel mondo del modellismo RC?!Sega entra nel mondo del modellismo RC?!
  • LEGO: Vespa 125 - Modellismo e mattoncini!LEGO: Vespa 125 - Modellismo e…
  • Catalogo Modellismo: Kyosho 2022Catalogo Modellismo: Kyosho 2022
RadiosistemiCarismaElectronic DreamsRadiositemi

Negozi di modellismo

Jet Model
Casa del Modellismo

Notizie in evidenza:

  • Kyosho: Inferno MP10 Tk13 4WD Nitro Buggy in scala 1/8 Kyosho: Inferno MP10 Tk13... Alla fiera del modellismo di Shizuoka del prossimo mese, che come da tradizione saremo l'unico med...
  • Novità LEGO Technic in arrivo a giugno! Novità LEGO Technic in ar... La LEGO non smette mai di sfornare novità e a giugno sono in arrivo tre nuovi set della linea Tech...
  • Kyosho alla fiera del modellismo di Shizuoka 2023 Kyosho alla fiera del mod... La Kyosho, pur non avendo lo stand più grande, è stato il brand con il maggior numero di novità di...
  • Tamiya alla fiera del modellismo di Shizuoka 2023 Tamiya alla fiera del mod... Lo stand più ampio e visitato dello Shizuoka Hobby Show 2023 è stato come sempre quello della Ta...
  • Kyosho: Gold Fantom Ext 60th Anniversary Limited Edition Kyosho: Gold Fantom Ext 6... Per celebrare i propri sessant'anni dalla fondazione Kyosho ha deciso di rlasciare una versione li...
  • The history of KYOSHO WORKS Team 1980 - 1989 The history of KYOSHO WOR... In occasione della fiera del modellismo di Shizuoka abbiamo incontrato il nostro amico Akira Kogaw...
  • The Dirt: Silverstate 2023 - Live streaming The Dirt: Silverstate 202... La leggendaria competizione di automodellismo offrod Silver State 2023 si sta svolgendo a Las Vega...
  • Pro Boat: PCF Mark I Swift Patrol Craft Pro Boat: PCF Mark I Swif... L'estate ormai è alle porte e l'americana Pro Boat ha annunciato il PCF Mark I: una replica in s...

Shopping:

© 2022 Hobby Media Srl - P.Iva 07941371002

width=
  • NEWS DI MODELLISMO
  • TECNICA RC
  • TAMIYA
  • TRAXXAS
  • LEGO
  • COMPETIZIONI
  • PISTE RC
  • ENGLISH 🇺🇸
Questo sito utilizza i cookie: Leggi di più.