Let's Make Robots!

connecting an i2c device with an AXE020 project board.

I've been thinking about playing around with i2c devices and I want to find a way to connect them to my

Axe020 project board. This thing.

After some initial problems with finding the pins on the project board that correspond to scl and sda

on my Picaxe 28X1, I finally found out that they are connected to the digital in 3 and 4.

Then I saw that all digital input pins have 10k pull down resistors on the project board, 

and I know that you need them connected to 4k7 pull up resistors to make them work with i2C devices.

This might be a really silly question, but will this be a problem, and if so, is there a way past it?

 

Lately I've been considering getting one of these to avoid future problems like this one.

Maybe I should get one before continuing with i2c?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

C'mon, he's got connections there and rx and tx code! What else do you need?!?

That's enough, it was just to be easier to find and collect.

 

 Forget

Out 4 to 2k7 to V1 to Out 4
Out 3 to 2k7 to V1 to Out 3

V1 to V1 and/or G to G

*******

hi2csetup i2cslave, %10100000
main:

if hi2cflag = 0 then main ' poll flag, else loop
hi2cflag = 0 ' reset flag
get hi2clast,b1 ' get last byte written
debug
goto main

******

hi2csetup i2cmaster, %10100000, i2cslow, i2cbyte
main:
inc b1 ' increment variable
hi2cout 0,(b1) ' send value to byte 0 on slave
pause 500 ' wait a while
debug
goto main

******

This is tested and works :)

That's cool!

But, if it isn't asking too much, can you make a short walkthrough with that?

 

Thanks :)

I thought about that but wasn't sure. I figured that you could just vary the value of the resistor so that there was more up than down... I just didn't want to give out any wrong advice.

To be honest, I'm not sure if this has a drawback or not, I just know it worked for me :) When I were connecting compass module for the first time I did not even think about pull down resistors :) I wonder how I managed not to cook any ICs so far :) so far, so good :)) But writing that posts above I was feeling confident, about what I write, and it makes me feel good :) I have learnt something :) Thank you, LMR, for that!! :)) So, back to our question:

It works, but we would like our E-gurus to enlighten us if it is bad or not to have pull down and pull up resistors in same time :)

There are two things to think about here, firstly that lower resistance pull-up/pull-down resistors means more current is wasted through them, and when dealing with very weak signals the pull-up/pull-down effect may overpower the signal you want to measure. Normally neither of these two things make any difference, but when things don't work quite right they're good to keep in mind.

The main drawbacks of having a pull-up and pull-down resistor are that:
• current is always being wasted by the pair of resistors, although unless you're worried about a few milliamps that's not a big deal.
• the two resistors form a voltage divider, which means that the line will never be pulled fully up or fully down. If there's no signal being applied, and you're using the 4.7kΩ up/10kΩ up arrangement, then the voltage at the input will be ~3.4V when using a supply of 5V. This is still high enough to turn a normaly digital input 'on', but if you were using a Schmitt trigger input it probably wouldn't be enough. At the end of the day it's better to have just a pull-up or pull-down resistor, but if you really need both then it won't do any harm provided the extra resistor you add is no more than half the size of the already existing one, but still at least a few kΩ. If it works, then you don't have to worry about it =)

4K7 is less than 10K, so the lines will still be pulled up. As well, I2C manual does not say you should have exactly 4K7 resistors, it could be anything between 1K8 to 47K. In case of 28 board I would actually suggest lower options considering we have 10K pull down resistor on each line.

so what reistors should I go for? 2 -3k or something like that? I keep running into these problems because I know way too little about electronics in general.

 

I was thinking of other ways around this thing today and thought of something.

Since the Axe031 I'm thinking about buying comes with a picaxe 18X (at least if you order it from techsupplies), could I program the servo movements into that and let it comunicate with the onboard slave IC via I2C, and have my 28X talk to the 18X with a serial interface, telling it what to do?

for example my 28X sees that the road ahead is clear via a sensor and sends the command "forward" to the 18X and the 18X is programmed with the servo movements to move the bot forward so it communicates those to the slave IC via I2C until the 28X says otherwise. If this works it would take a load off from the 28X and let it worry about sensor inputs and whatnot instead. Would save some space in the 28X's memory too.

I'm not sure if this is a good idea or not. Please tell me if I'm barking up the wrong tree.

 

 

Yeah, I think 2-3K would do.

Regarding other stuff: for now, I would recommend to keep things as simple as possible and use, say, only Picaxe 28X or whatever. But this is just me. Serial Comunication: this another reason to work with one chip. You would probably fall in the same trap I did: Picaxe either drive servos or wait for serial input. That means if you will issue serin or whatever serial input command all proccessing in IC stops, including sending out PWM signals for servos.