Let's Make Robots!

Looking for ideas on a I2C Pan/tilt stand-alone sonar

This quest to build a stand-alone I2C pan/tilt range finder controller started with an article here by Ladvien.  In    http://letsmakerobots.com/node/39130, Ladvien explores using an ATtiny85 (84) as an I2C motor controller...

And in http://letsmakerobots.com/node/39222,   Chris the Carpenter   gives us an awesome pan and tilt code example... so...

I personally have a need to offload the sonar rangefinding scan function from my primary Arduino, as it messes with the timers and  causes the entire system to run slowly.

As I want to be able to provide for the various devices most people use, there are not enough pins on the ATtiny85 for what I need, but the ATtiny84 will do just fine!

ATtiny84 short data sheet  -  ATtiny84 long data sheet

 

ATtiny84 pinout

Attached Devices:

Depending on whether you use Ping or MaxSonar ultrasound rangefinders, or Sharp IR rangefinders the pin requirements will differ.\

I will be designing this control module to accept any combination .  The Setup routine should identify what modules are attached, and provide output accordingly.

 

  • I will require the two pins SDA and SCL for the I2C interface.
  • I will require PWM outputs for the pan and tilt servos.
  • I will require two digital Inputs for front and rear MaxSonar EZ  rangefinders PWM.
  • I will require two digital Outputs for front and rear Ping SR04 rangefinders trigger.
  • I will share the MaxSonar digital input pins for for front and rear Ping SR04 rangefinders echo.
  • I will require two analog inputs for front and rear Sharp IR  rangefinders

That's a total of 2 I2C pins, 6 digital pins, and two analog pins.

Communications:

  • SET PAN TO: Angle from 0-180 degrees  Zero to the left, 90 degrees being center, and 180 to the right.
  • SET TILT TO: Angle from 0-135 degrees Zero being 45 degrees down, 90 being center, and 135 being straight up (thoughts???) 
  • SET PAN INCREMENT:  Range from 1 degree per increment to 10 degrees per increment (Again, thoughts?)
  • SET TILT INCREMENT:  Range from 1 degree per increment to 10 degrees per increment....
  • SET CONVERSION:  Boolean for Inches or Centimeters
  • SET SWEEP START:   Angle at which rangefinding sweep starts.
  • SET SWEEP END:   Angle at which rangefinding sweep ends.
  • INITIATE SWEEP:   Iniatiate a sweep, using current pan increment, sweep start and stop.
  • SET RETURN COUNT:   The number of data points to return on GET DATA
  • GET DATA:  Retrieve most recent full scan

 

Future Thoughts:

If there are enough cycles left after coding the above, allow for:

  • Return Polar Coordinates:   Data returned in consecutive integer pairs (Angle, distance)
  • Return Cartesian Coordinates:  Data returned in consecutive integer triplets (Angle, x, y)
  • Commit unused pins to LED/Infrared/Lazer illumination

 

So, before I commit this to circuit board, I would love to get your feedback.


 

References:


http://letsmakerobots.com/node/39130,

http://letsmakerobots.com/node/39222

 

http://www.instructables.com/id/Ultrasonic-Range-Finder-with-an-ATtiny85/

http://blog.iteadstudio.com/arduino-library-for-ultrasonic-ranging-module-hc-sr04/

http://www.instructables.com/id/Getting-started-with-the-Maxbotix-sonar-sensor-q/

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
The main question I have for you is whether you'll be programming the ATTiny using the Arduino as ISP method or if you'll be directly programming it with an AVRISP. A number of us (including. JerZ, myself and I believe Ladvien) have tried to get the cunning turtle servo library to function on these beasts with no luck. You might try putting a crystal on the Tiny, but I don't know if the cores support that in Arduino. Otherwise, I wouldn't expect any problems with i2c-I was able to use a Tiny45 programmed w/Arduino as ISP over i2c on my RPi more or less as a way of getting at the Tiny's ADC.

I had expected to use one of my other Arduino's to program it... I've now amassed a fair collection of these buggers..

Although I had not even considered the missing 16bit timer problem...  I'll admit that I've used an Arduino Mini Pro as the base of my development over the past day or so, as I do not yet have ATtiny chips to play with.  I've ordered a rail of them, but something about an international holiday or some such nonsense has them coming in next week.

I know that without the external xtal, the Serial library will not work properly above 19,200 baud, but the I2C protocol is extremely forgiving, even allowing for stretched clocking.

When had you tried it last, as the library was updated last year?

btw... I'd love to see your ADC via I2C code...      just sayin'

 

More References: