Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 25
121  Using Arduino / Programming Questions / Re: [RESOLVED] SoftwareSerial and Ethernet conflict on Mega? on: May 29, 2013, 12:51:21 pm
Just wanted to post small update. As expected Hardware Serial1 (RX1/TX1) works just fine controlling Roomba 551 from Arduino Mega2560. No need for SoftwareSerial. Hooray!!! smiley
Thanks again guys!
122  Using Arduino / Programming Questions / Re: [RESOLVED] SoftwareSerial and Ethernet conflict on Mega? on: May 28, 2013, 08:20:44 pm
Fair enough smiley I also came to a conclusion that Serial1,2 should work no problem, just didn't have chance to test it smiley is neato hacker friendly?
123  Using Arduino / Programming Questions / Re: SoftwareSerial and Ethernet conflict on Mega? on: May 28, 2013, 04:30:10 pm
First of all you already answered my question, thank you! smiley
As you pointed out SPI  on Mega uses digital ports 50,51,52 and 53 that's why I had conflict.  I should've realized it, but it wasn't obvious because Ethernet shield doesn't touch those pins. After you posted your comment I realized that it connects to those pins the via ICSP header.

You don't need to answer to anything I write below I'm just trying to explain since you asked...

The serial port output TXD from the iRobot Roomba is too weak to drive the RX serial port input of an Arduino properly.
This is because of the USB-Serial converter on the Arduino: it also tries to drive the RX serial port input via a pullup resistor,
but the Roomba does not have enough drive to pull the RX down below about 2.5 volts, which is insufficient to be reliably detected as a TTL serial input of 0.

As for my mentioning of Port 0 and 1, in the context of Serial communication in Arduino, I figured it would be obvious that I'm talking about PIN0 (RX) and PIN1 (TX).

Is this sufficiently clear now? smiley
124  Using Arduino / Programming Questions / Re: SoftwareSerial and Ethernet conflict on Mega? on: May 28, 2013, 10:33:42 am
You need to take a look at the pins that the Ethernet shield uses, on the Mega. Hint: 50, 51, 52, and 53.

Why are you using SoftwareSerial on a device with 4 hardware serial ports?
Oh I didn't realize it. I know on Uno it uses others smiley Thanks for the tip!
Roomba doesn't like standard Serial Ports for some reason (at least on Uno). There have been many reports online about this issue, so people either use some kind of hex buffer or SoftwareSerial. I verified with Port 0 and 1 it doesn't work. Haven't tried other serial ports
125  Using Arduino / Programming Questions / [RESOLVED] SoftwareSerial and Ethernet conflict on Mega? on: May 28, 2013, 09:11:21 am
I'm trying to control Roomba with Arduino Mega 2560 and Ethernet Shield (connected to portable WiFi bridge). On it's own, Arduino has no issues controlling Roomba.  Ethernet shield also works on it's own with default WebServer sketch.
But they do not work together.
Is there a documented conflict issue between SoftwareSerial and Ethernet libraries on Arduino Mega2560? I couldn't find much online. Software serial is setup on PIN50 (RX) and PIN51 (TX) at baud of 115200.
Here's a sketch below just in case...

Code:
#include <SoftwareSerial.h>
#include <SPI.h>
#include <Ethernet.h>

int rxPin = 50;
int txPin = 51;
int ledPin = 13;

SoftwareSerial Roomba(rxPin,txPin);

#define bumpright (sensorbytes[0] & 0x01)
#define bumpleft  (sensorbytes[0] & 0x02)

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);
EthernetServer server(80);

void setup() {
  pinMode(ledPin, OUTPUT);   // sets the pins as output
  Serial.begin(115200);
  Roomba.begin(115200);  
  digitalWrite(ledPin, HIGH); // say we're alive
  Serial.println ("Sending start command...");
  delay (1000);
   // set up ROI to receive commands  
  Roomba.write(128);  // START
  delay(150);
  Serial.println ("Sending Safe Mode command...");
  delay (1000);
  Roomba.write(131);  // CONTROL
  delay(150);
  digitalWrite(ledPin, LOW);  // say we've finished setup
  Serial.println ("Ready to go!");
  delay (5000);
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop() {
  digitalWrite(ledPin, HIGH); // say we're starting loop
  Serial.println ("Go Forward");
  goForward();
  delay (500);
  Serial.println ("Halt!");
  halt();
  Serial.println ("Go Backwards");
  delay (500);
  goBackward();
  delay (500);
  Serial.println ("Halt!");
  halt();
  while(1) { } // Stop program
}

void goForward() {
  Roomba.write(137);   // DRIVE
  Roomba.write((byte)0x00);   // 0x00c8 == 200
  Roomba.write(0xc8);
  Roomba.write(0x80);
  Roomba.write((byte)0x00);
}
void goBackward() {
  Roomba.write(137);   // DRIVE
  Roomba.write(0xff);   // 0xff38 == -200
  Roomba.write(0x38);
  Roomba.write(0x80);
  Roomba.write((byte)0x00);
}

void halt(){
 byte j = 0x00;
 Roomba.write(137);  
 Roomba.write(j);  
 Roomba.write(j);
 Roomba.write(j);
 Roomba.write(j);
}

When I comment out these two lines below, Roomba starts to work...
Code:
Ethernet.begin(mac, ip);
  server.begin();

Is there any workaround for this or my own choice is to go with WiFi shield?
126  Topics / Robotics / Re: Controlling Roomba [solved] on: May 26, 2013, 11:59:06 pm
Anyway I found solution on my own.  Little by little I figured out that 500 series Roomba undergone significant change in Open Interface (OI) format. All the books, tutorials, etc. are severely outdated unfortunately smiley-sad
Major changes are:
1. Baud rate is now 115200 by default
2. No more DD pin. Instead this pin (#5) is now used to change baud rate
3. Command 130 (Control) is no longer needed (but still supported). Instead command 131 (Safe Mode) does same thing.

I modified RoombaComm BumpTurn sketch to work with SoftwareSerial and series 500 Roombas. I also simplified it to just Move forward to half a second, stop and then move backwards (sort of Hello World).
Code:

 #include <SoftwareSerial.h>

int rxPin = 3;
int txPin = 4;
int ledPin = 13;

SoftwareSerial Roomba(rxPin,txPin);

#define bumpright (sensorbytes[0] & 0x01)
#define bumpleft  (sensorbytes[0] & 0x02)

void setup() {
  pinMode(ledPin, OUTPUT);   // sets the pins as output
  Serial.begin(115200);
  Roomba.begin(115200);  
  digitalWrite(ledPin, HIGH); // say we're alive
  Serial.println ("Sending start command...");
  delay (1000);
   // set up ROI to receive commands  
  Roomba.write(128);  // START
  delay(150);
  Serial.println ("Sending Safe Mode command...");
  delay (1000);
  Roomba.write(131);  // CONTROL
  delay(150);
  digitalWrite(ledPin, LOW);  // say we've finished setup
  Serial.println ("Ready to go!");
  delay (5000);
}

void loop() {
  digitalWrite(ledPin, HIGH); // say we're starting loop
  Serial.println ("Go Forward");
  goForward();
  delay (500);
  Serial.println ("Halt!");
  halt();
  Serial.println ("Go Backwards");
  delay (500);
  goBackward();
  delay (500);
  Serial.println ("Halt!");
  halt();
  while(1) { } // Stop program
}

void goForward() {
  Roomba.write(137);   // DRIVE
  Roomba.write((byte)0x00);   // 0x00c8 == 200
  Roomba.write(0xc8);
  Roomba.write(0x80);
  Roomba.write((byte)0x00);
}
void goBackward() {
  Roomba.write(137);   // DRIVE
  Roomba.write(0xff);   // 0xff38 == -200
  Roomba.write(0x38);
  Roomba.write(0x80);
  Roomba.write((byte)0x00);
}

void halt(){
 byte j = 0x00;
 Roomba.write(137);  
 Roomba.write(j);  
 Roomba.write(j);
 Roomba.write(j);
 Roomba.write(j);
}

Found Specs PDF here
127  Topics / Robotics / Controlling Roomba [solved] on: May 25, 2013, 01:25:47 pm
Hi,

I have Roomba 551 which I'm trying to control from Arduino Uno. I've read "Hacking Roomba" and other examples online how it should be connected, but no matter what I try, I can't get it to respond. I know there are issues with RX/TX lines so I'm using Software Serial, here's example of the sketch:

Code:
#include <SoftwareSerial.h>
SoftwareSerial roomba(5,3);  // RX,TX
int rxPin = 5;
int txPin = 3;
int ddPin = 7;
int ledPin = 13;
void setup() {
 pinMode(ddPin,  OUTPUT);   // sets the pins as output
 pinMode(ledPin, OUTPUT);   // sets the pins as output
 Serial.begin(57600);
 roomba.begin(57600);
 digitalWrite(ledPin, HIGH); // say we're alive
 // wake up the robot
 digitalWrite(ddPin, HIGH);
 delay(100);
 digitalWrite(ddPin, LOW);
 delay(500);
 digitalWrite(ddPin, HIGH);
 delay(2000);
 // set up ROI to receive commands  
 roomba.write(128);  // START as defined in manual(adim)
 delay(50);
 roomba.write(130);  // CONTROL adim
 delay(50);
 digitalWrite(ledPin, LOW);  
}

void loop() {
  goForward();
  delay(50);
  halt();  
}

void goForward() {
 byte j = 0x00;
 roomba.write(137);
 roomba.write(j);  
 roomba.write(0xc8);
 roomba.write(0x80);
 roomba.write(j);
}

void halt(){
 byte j = 0x00;
 roomba.write(137);  
 roomba.write(j);  
 roomba.write(j);
 roomba.write(j);
 roomba.write(j);
}

I made cable from old PS/2 miniDin connector. Pin 1 is V+, Pin 8 i GND, 3 is RX, 5 is TX, 5 is DD. I connected Roomba's RX to Arduino TX (pin 3) and TX to pin 5. DD is on Pin 7.
Roomba powers up my Uno board no problems, but it's not moving at all smiley-sad
Also I read that CSI voltage should be around 18V, but it's actually measures as 8 Volts. Is this because I only connected one V+ pin (I have no idea if they split voltage between two) ?
Any ideas on how to get it moving? smiley

EDIT: I found out that default baud is 115200. Changed code but it still doesn't work.
I have Roostick and was able to control Roomba from my computer via SCITest program.
128  Using Arduino / General Electronics / Re: Low profile push button on: May 20, 2013, 09:57:25 pm
Thanks! Something like this prob will work http://www.digikey.com/product-detail/en/GPB556A05BA/CWI280-ND/3193549
smiley
129  Using Arduino / General Electronics / Re: Low profile push button on: May 20, 2013, 10:15:25 am
Real button will do smiley i.e. momentary switch
I don't have any specific requirements other than for it to be as little protruding on the bottom as possible..
130  Using Arduino / Microcontrollers / Re: Help needed with ATMega644P bootloader on: May 20, 2013, 09:45:08 am
and signature bytes
Where do I specify signature bytes? In boards.txt file?

I also need to update my 644p with Optiboot version via Arduino IDE (I don't have ISP). Sanguino boot-loader is horrendous smiley-sad
Would changing boards.txt file and be sufficient or I need to do something else?
131  Using Arduino / General Electronics / Low profile push button on: May 20, 2013, 09:19:12 am
Can someone recommend a nice panel mounted push-buttons that have very low "backend" profile (i.e. mechanical part underneath is very short)?  I have very little space between panel and inside components, and regular buttons I have just don't fit smiley-sad
132  Using Arduino / Microcontrollers / Re: Beginner AVRDude questions on: May 15, 2013, 10:23:59 pm
1.  Do you have an auto-reset circuit hooked up from the FTDI RTS/DTR to the reset pin?  Also for auto-reset to work with uploads you should be using -carduino instead of -cstk500v1 with avrdude.

2.  The avrdude v5.10 lacks the wiring protocol support Arduino Mega2560 boards.  The avrdude.conf file with v5.10 also lacks some newer AVR chip definitions and the wiring programmer definition.


Awesome! Yes I do have auto-reset circuit. Thank you, -carduino works much better!
133  Using Arduino / Microcontrollers / Re: How to enable BOD fuse? on: May 15, 2013, 10:20:09 pm
You have the wrong baud rate for Arduino as ISP, should be -b19200.


I'm not using Arduino actually...
Tried 19200 it's not working at all at that baud smiley-sad
avrdude: stk500_getsync(): not in sync: resp=0x00
134  Using Arduino / Microcontrollers / Re: How to enable BOD fuse? on: May 15, 2013, 03:59:36 pm
Oh cool! Can it be done via USB?  I don't have dedicated ISP, and use Arduino as ISP...
Just Look in the avr-dude manual
It refuses to change high fuse bit smiley-sad
Code:
F:\>F:\Programs\WinAVR\bin\avrdude -patmega644p -cstk500v1 -P\\.\COM3 -b57600 -U
 efuse:w:0xfd:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0x1e960a
avrdude: reading input file "0xfd"
avrdude: writing efuse (1 bytes):

Writing |                                                    | 0% 0.00s ***faile
d;
Writing | ################################################## | 100% 0.13s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xfd:
avrdude: load data efuse data from input file 0xfd:
avrdude: input file 0xfd contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xfd != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: efuse changed! Was fd, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xed

avrdude done.  Thank you.

135  Using Arduino / Microcontrollers / Beginner AVRDude questions on: May 15, 2013, 01:52:11 pm
I never used AVRDude directly until today.
My goal is to use minimalist setup (i.e. standard install of WinAVR) to upload hex file via FTDI to custom ATMega644P board via a batch file that I will provide to 3rd party.
I got avrdude command from Arduino IDE 1.01 and it seems to be working with some minor issues. So my questions are:

1. After successful upload, if I try uploading second time I get Sync Error. Reinserting FTDI cable seems to help as well as opening and closing virtual COM port in program like RealTerm. Why is this happening? Any way around it other than what described earlier? smiley
2. Is custom avrdude.conf file needed?  It seems to work without specifying it (WinAVR just uses default unmodified file)
3. Arduino seems to have slightly newer version of AVRDude (5.11), even tho I got latest WinAVRDude (5.10). Just curious why would it be and should care about it much?

Anything else I need to watch out for?  As I mentioned goal is to give person who might not have any experience with AVRs easy way to upload hex firmware into device (i.e. Xronos clock).
I was thinking of just making batch file that will access COM port number and zipping up together with WinAVR folder and .hex file.   Then something similar for OSX too...

BTW here's command that I'm using:
Code:
F:\Programs\WinAVR\bin\avrdude -v -v -v -v -patmega644p -cstk500v1 -P\\.\COM6 -b57600 -D -Uflash:w:D:\projects\DIY\XRONOS\firmware\xronos1_05.cpp.hex:i
Pages: 1 ... 7 8 [9] 10 11 ... 25