Society of Robots - Robot Forum

Software => Software => Topic started by: yash25 on July 07, 2009, 04:45:12 PM

Title: Programming the tiny2313.
Post by: yash25 on July 07, 2009, 04:45:12 PM
Hi everyine. I'm making a basic Photovore bot with the Tiny2313. And I'm making it the exact same way as that shown in the 50$ robot tutorial. I'm also programming the chip with the 10 pin ISP cable which goes to the serial port of the pc. The only two places where i have diverted my project from the 50$ robot are as follows:
1) I've used a tiny2313 instead of the atmega8.
2) I'm using coreless pager motors instead of servos( with a motor driver circuit L293D).

Now, what changes do I make in my program and how ( so that my program satisfies both the modifications I have made in the circuit)?
Title: Re: Programming the tiny2313.
Post by: jamort on July 07, 2009, 07:43:57 PM
well the first thing your going to have to do is change what pins the output/ inputs on... im not really sure as im not familiar with the attiny series from atmel... then instead of digital output i believe its going to have to be analog... correct me if im wrong so its going to be rather much to change
Title: Re: Programming the tiny2313.
Post by: SmAsH on July 08, 2009, 12:46:48 AM
get the datasheet and where it says PD0, PD1 etc... thats where stuff will be connected, change if necessary...
Title: Re: Programming the tiny2313.
Post by: jamort on July 08, 2009, 01:06:02 AM
instead of pwn it will be spike right? were its analog
Title: Re: Programming the tiny2313.
Post by: yash25 on July 08, 2009, 02:05:30 AM
instead of pwn it will be spike right? were its analog
I did'nt understand that jamort! And what about the fact that im using pager motors instead of servos, will that change thae program?
Title: Re: Programming the tiny2313.
Post by: SmAsH on July 08, 2009, 02:11:23 AM
you still use pwm for motor drivers...
youll have two pins per motor... you will set one high and one low to determine the direction of rotation.
pwm can be used on this. i also think if you are short on pwm pins you can pwm the enable pins...
Title: Re: Programming the tiny2313.
Post by: yash25 on July 08, 2009, 02:49:38 AM
Ok...that was slightly greek to me...but here's my interpretation:
in my circuit, i have given two p[ins per motor, so what u are saying is that i make one permanently GND  so that i can vary the pulse width at the other pin and make it move.
what i did'nt understand was this:
pwm can be used on this. i also think if you are short on pwm pins you can pwm the enable pins...
do i have to give special pins called pwm pins? or are they one of the two pins that are going to the motor (...the ones that are'nt grounded)???
Title: Re: Programming the tiny2313.
Post by: Ro-Bot-X on July 08, 2009, 05:38:33 AM
My friend, you need to read the Motor controllerl tutorial here: http://www.societyofrobots.com/member_tutorials/node/159 (http://www.societyofrobots.com/member_tutorials/node/159) and the PWM tutorial here: http://www.societyofrobots.com/member_tutorials/node/228 (http://www.societyofrobots.com/member_tutorials/node/228)

I don't know the pin settings for the $50 robot so I can't tell you what pins you should use, unless you make a list and post it here, I will not look it up for you. But here are the pin settings I use in my dual motor controller using tiny2313:

// Module  Arduino Pin  Tiny2313   Pin   Arduino  Module
//                                 +-\/-+
// Reset               PA2  1|     |29  VCC
// RX         (D 0)   PD0  2|     |19  PB7  (D 16)    SCL (SKC )
// TX         (D 1)   PD1  3|     |18  PB6  (D 15)   (MISO)
// Xtal        (D 2)   PA1  4|     |17  PB5  (D 14)   SDA (MOSI)
// Xtal        (D 3)   PA0  5|     |16  PB4  (D 13)*  M1A (OC1B)
// Enc1A # (D 4)   PD2  6|     |15  PB3  (D 12)*  M2A (OC1A)
// Enc2A # (D 5)   PD3  7|     |14  PB2  (D 11)*  M1B
// Enc1B    (D 6)   PD4  8|     |13  PB1  (D 10)    M2B
// Enc2B  *(D 7)   PD5  9|     |12  PB0  (D 9)      M2En
//                      GND 10|     |11  PD6  (D 8 )     M1En
//                                +----+
//
// * indicates PWM port
// # indicates external interrupt
//
// M1 = RightMotor
// M2 = LeftMotor
// E1 = RightEncoder
// E2 = LeftEncoder

Module is my board, so that is the function of the pin in my board. Arduino is the name of the pin in Arduino and Pin is the pin name by data sheet.
Title: Re: Programming the tiny2313.
Post by: yash25 on July 08, 2009, 01:51:42 PM
Thank you so much Ro-bot X!!! im going to read all that right now!