Show Posts
Pages: 1 [2] 3
16  Using Arduino / General Electronics / Advise for circuit, and pcb layout on: January 28, 2014, 02:56:02 pm
Hi!

So I am designing a pcb for my robot, and I would greatly appreciate some constructive criticism.
I have attached the eagle schematic and board file.
I use 2 arduino's because I have 2 I2C devices and their address cant be changed for some reason... smiley-razz
and I am using BTN7971B For my motor controller as I will be controlling 4 fairly high power motors
I have attached the circuit which I based the design on for the motor controller, and also I am using a  lm2576 for 5v regulation for which
I have also attached the original circuit.
, basically If you wold have any advise/ tips on the layout/circuit please advise.
It's not finished, things like the pin outs to my sensor, the outline for the pcb are missing but most of the main circuitry is there.
One thing I am sure I will need to change is all the small capacitors being replaced for a larger one, any suggestions on a
suitable value for those capacitors would be great.
So any advise or suggestions would be much appreciated

Thanks
17  Using Arduino / Programming Questions / Re: getting data from a custom compass sensor on: October 04, 2013, 04:09:05 pm
Hi,

So I sort of left this project once school started, and now I'm giving it a second try,

Read this again:

http://www.gammon.com.au/i2c

Your code looks nothing like the examples there.

You need Wire.beginTransmission, not Wire.begin and you also need Wire.requestFrom.
I did add them in my latest version, and I am really trying to understand I2C better, but I just can't seem to figure out
how to use it on this compass sensor, Again all advise is much appreciated.
Code:
#include <Wire.h>
#include <SoftwareSerial.h>
void setup(){
  Wire.begin();                                               // Conects I2C
  Serial.begin(9600);
}
 void loop()
{
   char high, low;             
 
   int bearing;                             
   Wire.beginTransmission ();
   Wire.write(0x3B);           
   Wire.write(0x01);                             
   Wire.endTransmission();
   Wire.requestFrom(0x3B);             
   high = Wire.read();           
   low = Wire.read();           
             
      if(high==1)
      {
      bearing=256+low;
      }
   
      if(high==0)
  { 
    bearing=low;
  }
 
   Serial.println(bearing);
}
18  Using Arduino / Programming Questions / Re: getting data from a custom compass sensor on: July 30, 2013, 03:31:34 pm

Code:
#include <Wire.h>
#include <SoftwareSerial.h>
void setup(){
  Wire.begin();                                               // Conects I2C
  Serial.begin(9600);
}
 void loop()
{
   char high, low;             
 
   int bearing;                             
   Wire.begin();
   Wire.write(0x3B);           
   Wire.write(0x01);                             
   Wire.endTransmission();
   Wire.begin();
   Wire.write(0x3B);             
   high = Wire.read();           
   low = Wire.read();           
             
      if(high==1)
      {
      bearing=256+low;
      }
   
      if(high==0)
  { 
    bearing=low;
  }
 
   Serial.println(bearing);
}
19  Using Arduino / Programming Questions / Re: getting data from a custom compass sensor on: July 28, 2013, 10:13:17 am
So I tried using 0x3B, still nothing,
Any other ideas?
20  Using Arduino / Programming Questions / Re: getting data from a custom compass sensor on: July 20, 2013, 08:13:42 am
If it says 0x3B that's the address you've got to use. Where did you get 0x76 from? I couldn't see a datasheet at that link.
It was in the code I found for the custom controller in the install files for the custom software
as included in my original post:
Code:
#ifdef _GETCOMPASSB_
 #ifndef  _GETCOMPASSB_EXISTS_
  #define _GETCOMPASSB_EXISTS_
  #include <jmkernel.h>
  #include "I2C_Soft.h"

  #ifndef _COMPASS_
   #define _COMPASS_ unsigned long
  #endif

  unsigned int GetCompassB(_COMPASS_ which){
    struct select *information=&which;
    unsigned char ddr1=portarray[1][information->group1];
    unsigned char ddr2=portarray[1][information->group2];
    unsigned char port1=portarray[2][information->group1];
    unsigned char port2=portarray[2][information->group2];
    unsigned char pin1=portarray[0][information->group1];
    unsigned char pin2=portarray[0][information->group2];
    unsigned char bit1=information->bit1;
    unsigned char bit2=information->bit2;
    SDA_DDR=ddr2;
    SDA_PORT=port2;
    SDA_PIN=pin2;
    SDA_BIT=bit2;
    SCL_DDR=ddr1;
    SCL_PORT=port1;
    SCL_BIT=bit1;

    unsigned char low;
    unsigned char high;
    unsigned int angle;
    Soft_I2C_Start();
    Soft_I2C_Write(0x76);
    Soft_I2C_Write(0x01);
    Soft_I2C_Start();
    Soft_I2C_Write(0x77);
    high=Soft_I2C_Read(0);
    low=Soft_I2C_Read(1);
    Soft_I2C_Stop();

    if(high==1)
      angle=256+low;
    else
      if(high==0)
        angle=low;
      else
        angle=9999;
    return angle;
  }
 #endif
#endif
21  Using Arduino / Programming Questions / Re: getting data from a custom compass sensor on: July 19, 2013, 04:53:09 pm
How is the compass connected to the Arduino? It may not be a software issue.
I'm pretty sure it's not a hardware issue, I even have the pull up resistors.
Code:
   Wire.begin();
   Wire.write(0x76);           
   Wire.write(0x01);                             
   //Wire.endTransmission();

Nothing gets written until you do Wire.endTransmission(); so the code you posted won't do much.

Read this, you should be more comfortable with I2C after wading through it. smiley

http://www.gammon.com.au/i2c

I un-commented that line, still no difference.
I read what you advised, I do understand I2C a bit better now, but I am still confused on how I can change the original code for
the custom controller to get it to work on my arduino.
It is a JoinMax compass, JMP-BE-2611, http://en.robotplayer.com/products/list.asp?id=70
The price of 81 dollars seems extremely high. Is it tilt compensated ? Is the I2C connected to the sensor, or to a microcontroller inside ?

The example code uses 8-bit address, shift it to right for the Arduino Wire library. But you first have to run the i2c scanner to see if the I2C bus is working.
http://playground.arduino.cc/Main/I2cScanner

A HMC5883L breakout board costs less than 3 dollars on Ebay, inclusive shipping.

I ran it, It said: "I2C device found at address 0x3B"
and yeah, ill probably get another compass if I can't get this to work,
but I got this used, for way less, and It has quite steady/good readings in comparison with other compass sensors I have used.
So anyway 0x3B? should I try that address?
22  Using Arduino / Programming Questions / getting data from a custom compass sensor on: July 16, 2013, 03:54:03 am
Hi!

So recently I got my hands on a couple of relatively good compass modules from china:
http://www.robotplayer.com/products/post.asp?pid=149
the page is in chinese, but with google translate I got the gist of it.
they work great with they're own controller,
http://www.robotplayer.com/products/post.asp?pid=109
however I would like to get it to work with by arduino.
I started looking through the files for the drag and drop programming software for these controllers and I guess I found the C file that is used to get data from the compass,
Code:
#ifdef _GETCOMPASSB_
 #ifndef  _GETCOMPASSB_EXISTS_
  #define _GETCOMPASSB_EXISTS_
  #include <jmkernel.h>
  #include "I2C_Soft.h"

  #ifndef _COMPASS_
   #define _COMPASS_ unsigned long
  #endif

  unsigned int GetCompassB(_COMPASS_ which){
    struct select *information=&which;
    unsigned char ddr1=portarray[1][information->group1];
    unsigned char ddr2=portarray[1][information->group2];
    unsigned char port1=portarray[2][information->group1];
    unsigned char port2=portarray[2][information->group2];
    unsigned char pin1=portarray[0][information->group1];
    unsigned char pin2=portarray[0][information->group2];
    unsigned char bit1=information->bit1;
    unsigned char bit2=information->bit2;
    SDA_DDR=ddr2;
    SDA_PORT=port2;
    SDA_PIN=pin2;
    SDA_BIT=bit2;
    SCL_DDR=ddr1;
    SCL_PORT=port1;
    SCL_BIT=bit1;

    unsigned char low;
    unsigned char high;
    unsigned int angle;
    Soft_I2C_Start();
    Soft_I2C_Write(0x76);
    Soft_I2C_Write(0x01);
    Soft_I2C_Start();
    Soft_I2C_Write(0x77);
    high=Soft_I2C_Read(0);
    low=Soft_I2C_Read(1);
    Soft_I2C_Stop();

    if(high==1)
      angle=256+low;
    else
      if(high==0)
        angle=low;
      else
        angle=9999;
    return angle;
  }
 #endif
#endif
now my question is how would I write this for my Arduino, here is one of my (failed) attempts:
Code:
#include <Wire.h>
#include <SoftwareSerial.h>
void setup(){
  Wire.begin();                                               // Conects I2C
  Serial.begin(9600);
}
 void loop()
{
   char high, low;             
 
   int bearing;                             
   Wire.begin();
   Wire.write(0x76);           
   Wire.write(0x01);                             
   //Wire.endTransmission();
   Wire.begin();
   Wire.write(0x77);             
   high = Wire.read();           
   low = Wire.read();           
             
      if(high==1)
      {
      bearing=256+low;
      }
   
      if(high==0)
  { 
    bearing=low;
  }
 
   Serial.println(bearing);
}

Any ideas/tips on how to get this to work would be much appreciated, please forgive my ignorance if I made a dumb programming mistake.
23  Topics / Robotics / Re: RoboCup Junior Soccer Robot on: March 31, 2013, 03:08:42 pm
Hi!
Hi!

I am referring to the two metal pieces next to the compass sensors,
which I can see on your picture.

Best Regards

There is nothing at the compass. the metal pieces are used as holders for the referees. In our videos
you will see it.

Tobias
Oops, sorry my bad, I didn't see the back side of the holder. smiley-razz
Anyways thanks for all your help, I hope I will be able to meet you guys at Robocup!

Best Regards
 
John
24  Topics / Robotics / Re: RoboCup Junior Soccer Robot on: March 30, 2013, 02:31:58 pm
Hi!

I am referring to the two metal pieces next to the compass sensors,
which I can see on your picture.

Best Regards
25  Topics / Robotics / Re: RoboCup Junior Soccer Robot on: March 30, 2013, 11:29:07 am
Hi!

One last thing, I saw you used some-sort of metal to shield the compass sensor.
What is it? And where can you buy it?
I have been experimenting with mu-metal, is it that?

Thanks

Best Regards
26  Topics / Robotics / Re: RoboCup Junior Soccer Robot on: March 28, 2013, 01:07:12 am
Hi!

Could you send me the sizes of that pipe?
I have been trying to use heat-shrink tubing, but it doesn't work that good.
I am in the team Jakrobotics, previously we were called Hunrobot.
But we didn't attend Robocup2012.
So are you guys going with a Small size league team?

Regards
27  Topics / Robotics / Re: RoboCup Junior Soccer Robot on: March 27, 2013, 04:32:00 pm
Amazing!

I am also a Robocup junior soccer competitor!
And I love that the you put up everything to be open source, if only there were more teams like you!
I am planning on going to robocup2013 in holland, will you guys be participating this year?
Anyways, I hopefully will do the same with my robot once it's done.
One question, you said you used the TSOP1140?
I am currently experimenting with the TSOP1138, but I am having tons of trouble with the viewing angles.
Did you use anything to shield the sensors viewing angle?
Also, what kind of components did you use for the light barrier?

Best Regards
28  Using Arduino / Sensors / Robocup Junior soccer ball sensor on: November 30, 2012, 02:58:21 pm
Hi!

I am a Robocup Junior soccerhttp://rcj.robocup.org/soccer.html competitor,
 and I am currently in the process of selecting my ball sensor.
Now I found this article :
http://rcj.robocup.org/rcj2009/newball/cheapRCJ05sensors-RobotDemos09.pdf
And I ordered the TSOP1138 and connected it as the circuit in the document says I should with
a 100k resistor and a 1uF cap to get an analog reading.
The code I used is the Analog Serial Read example code
Code:
void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
}
And I am not getting any readings back besides 0.
So I did some further research and it turns out the ball actually outputs 40 khz instead of 38 which the sensor is set at,
but I should get at least some readings right even with the 2khz difference?
And also I don't suppose it's an issue but the capacitor I have is 1uf and 16v, would that be an issue?
Any advise appreciated, or if any one could suggest a better ball sensor!

Best Regards
29  Using Arduino / Sensors / RPM Counter / Tachometer on: August 20, 2012, 03:12:45 pm
I recently tried to use this:
http://arduinoprojects101.com/arduino-rpm-counter-tachometer/
But it doesn't seem to be working.
I used the Infrared Emitter and Detector from Radioshack:
http://www.radioshack.com/product/index.jsp?productId=2049723
would that be an issue?
Any suggestions?
30  Using Arduino / Sensors / Re: SRF08 sensor not working on: August 05, 2012, 01:51:19 am
Quote

I think you mean '< 1'  or possibly '== 0'.

OK I tired both but I'm not even using that function, all I want is the distance not the light value.
What else should I try?
Pages: 1 [2] 3