Show Posts
Pages: [1] 2
1  Using Arduino / Project Guidance / Re: A Robot base for SLAM experiments on: May 15, 2014, 08:19:03 am
The robot will work indoor in an environment with flat ground so this should not be a problem.

I also consider possibility to use some caster like http://www.emmeshop.it/product.php?id_product=1057 instead omni ball but I'm little worried about the influcence caster can have on robot.

I think, since it will move on smooth surface, make more sense to take advantages of omni wheel but, since this is my second robot, I'm not so experienced and maybe I wrong to evaluate side effects!

2  Using Arduino / Project Guidance / A Robot base for SLAM experiments on: May 15, 2014, 04:31:32 am
Hi everybody,

I'm starting a new Robot project after the experience with my first, and small, one.

My goal is to build up a robot base platform to be used to play with SLAM algorithm and image vision. From the experience on my first robot I got this guide lines for this second one:
- get a good control of motors speed;
- high resolution encoders;
- low center of gravity.

To achieve those goal I choose the RD02 drive system (http://www.robot-electronics.co.uk/cgi-bin/sh000001.pl?REFPAGE=http%3a%2f%2fwww%2erobot-electronics%2eco%2euk%2f&WD=rd02&PN=Drive_Systems%2ehtml%23a5#a5). The chassis base will be hand made from carbon/glass fiber plate.

Here a drawing of my project:



I choose to use omni ball instead caster since the caster can create some uncontrolled move during direction changes. Furthermore I add 4 of them in order to increase the ground base area (increase stability) and to reduce the load on each omni ball.

What do you think about? Do you have some suggestion for me before I start construction?

Thanks
Alessandro
3  Topics / Robotics / How to improve robot motors controllability on: December 09, 2013, 03:53:16 am
Hi all,

I'm implementing moving logic for my robot using Arduino DUE, Magician Chassis (http://www.homotix.it/catalogo/robotica-e-accessori-438/magician-chassis) and TB6612FNG motor control (https://www.sparkfun.com/products/9457). The DUE is powered by a 9V battery and motor by separate four AA battery (so 6V).

The system is working but the problem is that I cannot move my robot at low speed: if I set the PWM of two motors to a value less than 128-172 the motor has not enough torque to move the robot.

Probably I'm using too low cost component but by now I need to be able to move my robot with more precision so I'm ready to change some components.

What can I do to improve the situation (change motors, change motor control, increase the motor battery...) ?

Thanks
ALe
4  Topics / Robotics / (SOLVED): HELP: Need help to make my odometer works on: November 10, 2013, 06:40:33 pm
I followed suggestion from Cr0sh and improve the packaging of the odometer.

Furthermore I make fine tuning of trigger treshold and now it works!

Thanks all
Ale
5  Using Arduino / Programming Questions / (SOLVED) Re: Need help to include libs on my project! on: November 10, 2013, 06:37:48 pm
Hi all,

taking a glance from TFT library,  Adafruit_GFX.h file:

Quote
[...]It works if this
 * include is used only in one .cpp file in the build (this is the
 * case of most Arduino sketches); if used in multiple .cpp files,
 * the linker may complain about duplicate definitions.

I simply fixed using Adafruit libs from their git hub that has not
this bug (but load image is no so simple like on TFT...).

Thanks for support
Ale
6  Using Arduino / Programming Questions / Re: Need help to include libs on my project! on: November 08, 2013, 10:57:31 am
Sorry, no more snippets... I added the complete code as attachment!


Thanks
Ale
7  Using Arduino / Programming Questions / Need help to include libs on my project! on: November 08, 2013, 06:16:35 am
Hi all,

I'm working to my project with Arduino DUE but I'm now stopped by this error! I'm using Arduino IDE 1.5.4.

This the includes on my sketch:

Code:
#include <SD.h>
#include <SPI.h>
#include <TFT.h>
#include "TB6612FNG.h"
#include "QRE1113AEncoders.h"
#include "GeduinoPINS.h"
#include "Control.h"

This is the Control.h file:

Code:
#ifndef Control_h
#define Control_h

#include <SD.h>
#include <SPI.h>
#include <TFT.h>

class  Control{

private:
 
public:

  // Constructor
  Control();
 
  // Show splash screen for given time in milliseconds
  void showSplashScreen(unsigned const long splashDelay);

};

#endif

The problem I have is related to usage of SD, SPI and TFT library. I need to use them on the Control class but if I remove the include for those libraries from my sketch I had a "No such file or directory" error.

Code:
In file included from Control.cpp:3:
Control.h:4: fatal error: SD.h: No such file or directory
compilation terminated.

Including those libraries on the sketch seems to fix this problem bit create a new one:

Code:
GeduIno.cpp.o: In function `PImage::read32(File)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:296: multiple definition of `PImage::read32(File)'
Control.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:296: first defined here
GeduIno.cpp.o: In function `PImage::read16(File)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:289: multiple definition of `PImage::read16(File)'
Control.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:289: first defined here
GeduIno.cpp.o: In function `PImage::loadImage(char const*)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:306: multiple definition of `PImage::loadImage(char const*)'
Control.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:306: first defined here
GeduIno.cpp.o: In function `Adafruit_GFX::image(PImage&, unsigned short, unsigned short)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:231: multiple definition of `Adafruit_GFX::image(PImage&, unsigned short, unsigned short)'
Control.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/TFT/src/utility/Adafruit_GFX.h:231: first defined here
collect2: ld returned 1 exit status

Probably this is related to some problem with ifdef/endif on those libs but by now I still no found a solution...

PLEASE HELP ME!!!

Thanks
Ale
8  Topics / Robotics / Re: HELP: Need help to make my odometer works on: November 03, 2013, 12:50:48 pm
Another update: I tried to merge the two last sketch and change the guidoEncA function:

Code:
void guidoEncA() {

   const int guidoEncAState = digitalRead(GUIDO_ENCA);
   if (guidoEncAState == HIGH && guidoEncAPreviousState == LOW) {
     guidoEncACount = guidoEncACount + 1;
   }
   guidoEncAPreviousState = guidoEncAState;
 
}

In this way it works but... why?

RISING interrupt should not be called when the pin pass from LOW to HIGH?

I'm starting to be really confused about interrupts....

Thank to everyone can explain me how they are working!

Bye
Ale
9  Topics / Robotics / Re: HELP: Need help to make my odometer works on: November 03, 2013, 11:38:39 am
I'm following suggestions by cr0sh:

Quote
First - clean up your code and narrow the function of the code down to -just- showing a count based on the sensor input. Turn the wheel by hand or via a battery. Basically doing this will rule out anything else that might be causing issues.

I remove all other code from my sketch:
Code:
#include "GeduinoPINS.h"

unsigned volatile int guidoEncACount = 0;
unsigned volatile int guidoEncBCount = 0;


void setup() {

   Serial.begin(9600);
 
  attachInterrupt(GUIDO_ENCA, guidoEncA, RISING);
  attachInterrupt(GUIDO_ENCB, guidoEncB, RISING);

}

void guidoEncA() {
    guidoEncACount = guidoEncACount + 1;
}

void guidoEncB() {
  guidoEncBCount = guidoEncBCount + 1;
}

void loop() {

  Serial.print(guidoEncACount);
Serial.print(" ");
Serial.println(guidoEncBCount);

 }

I'm surprised by results: it's not working yet as expected but is really more stable. For a complete wheel round I should have 6 'clicks' by the encoder. Using this code counters are increased sometimes by 1 or 2 per clicks (before sometimes it was incremented also by 100!). I moved the wheel by hands and it seems the behavior is not affected by the wheel speed.

I try also this code:

Quote
#include "GeduinoPINS.h"

unsigned  int guidoEncACount = 0;
unsigned  int guidoEncBCount = 0;
int guidoEncAPreviousState = LOW;
int guidoEncBPreviousState = LOW;
int count = 0;

void setup() {

   Serial.begin(9600);
   
   pinMode(GUIDO_ENCA, INPUT);
   pinMode(GUIDO_ENCB, INPUT);
 
}

void loop() {

  const int guidoEncAState = digitalRead(GUIDO_ENCA);
  const int guidoEncBState = digitalRead(GUIDO_ENCB);
 
  if (guidoEncAState == HIGH && guidoEncAPreviousState == LOW) {
     guidoEncACount++;
  }
 
  if (guidoEncBState == HIGH && guidoEncBPreviousState == LOW) {
     guidoEncBCount++;
  }
 
  guidoEncAPreviousState = guidoEncAState;
  guidoEncBPreviousState = guidoEncBState;
 
  if (count++ == 1000) {
    Serial.print(guidoEncACount);
    Serial.print(" ");
    Serial.println(guidoEncBCount);
    count = 0;
  }

}

More surprised again: it works perfectly!
I add the if statement on the serial output in order to avoid a fix delay after every read.

Quote
You have what appears to be a simple encoder wheel printed on paper and either taped or glued to the encoder wheel supplied with the kit and motor; it doesn't appear like you have mounted that paper wheel perfectly flat on the supplied encoder wheel; it needs to be kept as perpendicular to your sensor as possible. In fact, printing it on heavier stock may be in order. Also, increase the darkness level of your printer as much as possible, and make sure you are printing with black ink only (not some fake combo like some printers use) - ideally, you should be using a black and white laser printer and toner, on the darkest and densest print setting. Even better would be to use flat (non-gloss) black and white paint (instead of printing).

I know this is not well build! BTW I use laser printer and I also tested the result with sensor before mounting and the output change from 0.3 to 3.2 passing from black to white, so I think they are ok. In future I want to improve it using white sticky paper for white bands black velvety sticky paper for the black ones (this should be best to avoid reflection at all). I will also build a 'case' to isolate encoders between them and the environment.

During design I first think about the sparkfun sensor you link but it was too wide and not so easy to integrate on my project. Of course, if I will fail with actual system, I will try it.



Thanks for all suggestion but I think I have some general problem with interrupts. I absolutely need to use it for my encoders but I really cannot understand the behavior of my code. I have a lot on experience on computer programming but not on microcontrollers and I'm learning is something complete differently.

Can anyone explain what happens?

Thanks for support
Ale
10  Topics / Robotics / Re: HELP: Need help to make my odometer works on: November 02, 2013, 04:59:21 am
So are you getting multiple interrupts from a single transition of your wheel ?

Yes, exactly! Also moving the wheel really slow with my hand the value is increased by 10, 20 sometimes also more.

Or is your program running so slowly  that you only get to check,   after the wheel has turned many times ?

Of course the display it's not real time refreshed: but if my wheel moved only from a black area to the next white one
the increment should be one.

Or are you getting spurious triggering from your wheel ?   Most implementation seem to be trying to shine some kind
of light through a hole or slot in the wheel,   not trying to detect the black and white colour.

This is what I think is happening! My system works really similar: instead to have an hole I have white/black area. The sensor has an emitter and a receiver and the black/white area absorb/reflect the emitted signal. Do you think this should be the cause of my problem?

This is the Eagle schema of the system:



On the left side there is the sensor schema from Sparkfun. On the right side the OpAmp used to transform the incoming signal to a square wave.

O nice this is a similar problem to the button bounce. For this reason I try to add and RC filter before the trigger without result.
I think I need an oscilloscope in order to "debug" my hardware!
 
11  Topics / Robotics / Re: HELP: Need help to make my odometer works on: October 31, 2013, 10:29:22 am
Quote
Any advice on how to fix my problem?
Don't suppose that seeing your code is a possibility, is it?
To be honest no... it's an hardware problem!

Btw, this is the sketch I'm using now for testing:

Code:
#include <TFT.h>
#include <SPI.h>
#include "TB6612FNG.h"
#include "GeduinoPINS.h"

TB6612FNG tb6612nfg;
TFT TFTscreen = TFT(CONTROL_CSLD, CONTROL_DCLD, CONTROL_RESET);

unsigned volatile int guidoEncACount = 0;
unsigned volatile int guidoEncBCount = 0;

long lastReadA = 0;
long lastReadB = 0;

void setup() {

   Serial.begin(9600);
 
  // Attach tb6612nfg
  tb6612nfg.begin();
 
  attachInterrupt(GUIDO_ENCA, guidoEncA, RISING);
  attachInterrupt(GUIDO_ENCB, guidoEncB, RISING);

  pinMode(CONTROL_JUP, INPUT);
  pinMode(CONTROL_JDW, INPUT);
  pinMode(CONTROL_JLX, INPUT);
  pinMode(CONTROL_JRX, INPUT);
 
  pinMode(CONTROL_JCN, INPUT);
  pinMode(CONTROL_ENCA, INPUT);
  pinMode(CONTROL_ENCB, INPUT);

  TFTscreen.begin();
  TFTscreen.background(0, 0, 0);
  TFTscreen.stroke(0,0,0);
  TFTscreen.setTextSize(2);
}

void guidoEncA() {
 // long now = millis();
 
 // if (now - lastReadA > 20) {
    guidoEncACount = guidoEncACount + 1;
 // }
 // lastReadA = now;
}

void guidoEncB() {
 // long now = millis();
 // if (now - lastReadB > 20) {
  guidoEncBCount = guidoEncBCount + 1;
 // }
 // lastReadB = now;
}

void loop() {

  int up = digitalRead(CONTROL_JUP);
  int down = digitalRead(CONTROL_JDW);
  int left = digitalRead(CONTROL_JLX);
  int right = digitalRead(CONTROL_JRX);
   int confirm = digitalRead(CONTROL_JCN);
  int enca = digitalRead(CONTROL_ENCA);
  int encb = digitalRead(CONTROL_ENCB);

  Serial.print(up);
  Serial.print(down);
  Serial.print(left);
  Serial.print(right);
  Serial.print(confirm);
  Serial.print(enca);
  Serial.print(encb);
  Serial.print(" ");
  Serial.print(guidoEncACount);
Serial.print(" ");
Serial.print(guidoEncBCount);
Serial.print(" ");
Serial.println(lastReadA);

char printA[4];
char printB[4];
String(guidoEncACount).toCharArray(printA, 4);
String(guidoEncBCount).toCharArray(printB, 4);

TFTscreen.background(0, 0, 0);
TFTscreen.stroke(255,255,255);
TFTscreen.text(printA, 0, 20);
TFTscreen.text(printB, 0, 50);

  if (up == HIGH) {

    // Set spped
    tb6612nfg.setSpeed(32,32);

    // Start motors
    tb6612nfg.start();

    delay(1000);

    tb6612nfg.stop();
  } else if (down == HIGH) {
    // Set spped
    tb6612nfg.setSpeed(-128, -128);

    // Start motors
    tb6612nfg.start();

    delay(1000);

    tb6612nfg.stop();
  } else if (left == HIGH) {
   
    // Set spped
    tb6612nfg.setSpeed(64,-64);

    // Start motors
    tb6612nfg.start();

    delay(250);

    tb6612nfg.stop();
   
  } else if (right == HIGH) {
   
    // Set spped
    tb6612nfg.setSpeed(-64,64);

    // Start motors
    tb6612nfg.start();

    delay(250);

    tb6612nfg.stop();
   
  }

  delay(100);
}


On this code the filter system I used is commented.

Thanks
Ale
12  Topics / Robotics / HELP: Need help to make my odometer works on: October 31, 2013, 04:02:33 am
Hi all,

I need help in order to make my robot odometer works. I'm building my robot in order to make some study around SLAM systems so the odometer is really important for my project.

My robot is based on this chassis: http://www.homotix.it/catalogo/robotica-e-accessori-438/magician-chassis
I work to add odometer to it using an encoder wheel with 6 black band and a IR sensor (https://www.sparkfun.com/products/9453) to detect the wheel rotation. This sensor give as output a tension that change when the black or white band pass ahed the sensor.


(package will be improved as soon it will works!)

In order to transform the signal wave to a square wave that can be used with arduino interrupt I added a Schmitt trigger: using this circuit schema the signal became HIGH when the output rise above a threshold and LOW when the output drop down a second threshold lower than the previous one.
I used an OpAmp to implement this schema (http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/schmitt.html).

I attached the output to my Arduino DUE digital pin and attach interrupt to them. On the interrupt void a volatile int counter is incremented by one for every wheel.
Unfortunately it is not working as expected. When the robot is moving my interrupts are called a lot of time for a single passage from black to white band, so, instead to have:
0,1, 2, 3, 4....
I have
0,12,34,78,134....

I added the trigger just to avoid this.... argh   smiley-mad

By now I solve it by software: when the interrupt void is invoked I check invocation time and make difference between last invocation: if the difference is less that a threshold I don't update the counter. In that it works better but really prefer to make it work in the right way.

So, what's the right way to connect the IR to arduino? Any advice on how to fix my problem?

Thanks all for support
Ale
13  Using Arduino / Displays / Re: How to control brightness on Arduino TFT on: October 29, 2013, 06:31:13 am
Just un update: using 5V instead 3V3 improve the brightness.

Thanks
Ale
14  Using Arduino / Displays / How to control brightness on Arduino TFT on: October 28, 2013, 12:36:47 pm
Hi all,

I bought the Arduino TFT (http://arduino.cc/en/Main/GTFT) for my robot and connect it to Arduino DUE.
Good news: both display and sd card works ok.

My issue regarding the lcd luminosity: it's really low comparing it with some video/picture from web (see for ex. http://arduino.cc/en/uploads/Guide/UnoTFT.jpg).

How I can have the same luminosity?

I connected the LCD following http://arduino.cc/en/Guide/TFTtoBoards page for DUE board (with some changes to fullfit my project design):
+5V:   +3.3V
MISO:   Miso pin (white wire on ICSP)
SCK:   Sck pin (brown wire on ICSP)
MOSI:   Mosi pin (yellow wire on ICSP)
LCD CS:   pin 42
SD CS:   pin 40
D/C:   pin 38
RESET:   pin 44
BL:   +3.3V
GND:   GND

First of all: I connected LCD CS, SD CS, D/C and RESET to other pins since they don't need PWM.... right?
Second question: it seems the LCD can be powered by 5V so why, on the link, they suggest to connect to 3V3?
Third question: I look on the web for explanation on what LCD CS, SD CS and D/C works but I found nothing.

I did not try to connect to 5V (maybe luminosity will be improved) since, after some chip burned, I want to be sure it will not destroy my LCD...

Thanks for any advice
Ale
15  Using Arduino / Sensors / Broken MPU6050 on: October 21, 2013, 05:36:43 pm
Hi all,

today I try to connect my MPU6050 to my Arduino Ethernet. I did it some months ago but I had to use Arduino for other purpose so I remove the MPU from my bread board and out it on the box.

In the main while I update my IDE (1.5.4) and the MPU6050 libs from Jeff Rowberg.

Unfortunately today I was not able to make it works: I always receive "Connection failed".
I connect the MPU on following way:
VCC - 3.3V
GND - GND
SDA - Analog A4
SCL - Analog A5

I was quite frustrated and try also the I2C Scanner (http://playground.arduino.cc//Main/I2cScanner) without result: my device was not found.

I'm starting to think I destroy the MPU in same way I don't know... do you have any idea how I can check if it is working?

Thanks a lot
Alessandro
Pages: [1] 2