﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>RoboticsConnection User Forum / RoboticsConnection Hardware Support / Robot Sensor Support  / I2C Line Following Sensors Help / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>RoboticsConnection User Forum</description><link>http://www.roboticsconnection.com/userForums/</link><webMaster>info@roboticsconnection.com</webMaster><lastBuildDate>Thu, 20 Nov 2008 09:50:15 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Thank you very much for your kind help Ringo. I tried it this way for one of the sensors and i think it worked but did it in a hurry coz labs were closing at uni so ill try it again tomorrow but hopefully it will work and will let you know of the outcome....&lt;br&gt;&lt;br&gt;thanks alot! :)</description><pubDate>Thu, 24 Apr 2008 16:14:33 GMT</pubDate><dc:creator>adilmemon</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>You are correct. I put those there when I designed the board, then forgot they were there.&lt;/P&gt;&lt;P&gt;Yes, if you connect Vcc and ground and hold the board up in the air, then put your finger very near 1 of the sensors, you will see the green led light up on the sensor board. when it does the line connected to that sensor goes low (0), move your finger away and the green led goes off and the line goes high (1).&lt;/P&gt;&lt;P&gt;the downside is that you must use 5 I/O lines in stead of just 2 for I2C, but you do not need the pulllup resistors anymore.&lt;/P&gt;&lt;P&gt;Ringo</description><pubDate>Thu, 24 Apr 2008 11:27:32 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>hi,&lt;br&gt;&lt;br&gt;that sounds like something good and easy....&lt;br&gt;jus need to confirm....u mean if i take the sensor and look on the side where the sensors are fixed i see a series of 7 holes in the middle of the board...are they the outputs from the sensors and if I solder them and take those wires to my PIC i will be able to read a 1 or a 0 directly for each sensor?&lt;br&gt;&lt;br&gt;and could i jus connect vcc and gnd to the ones already given on the sensor board? so no need for any pull up resistors anymore?&lt;br&gt;&lt;br&gt;Thank you</description><pubDate>Thu, 24 Apr 2008 11:20:31 GMT</pubDate><dc:creator>adilmemon</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Something I just thought of.&lt;/P&gt;&lt;P&gt;If you know how to just read an input pin with your compiler, then you could tap into the I/O from the sensors directly. If you look in the middle of the PCB on the opposite side of the board from the pic, you will see a series of header pads. They are labeled A-E and Vcc and Gnd. If you can solder a wire from A to an input on your chip, and from B to an input on your chip, etc, then you can see the I/O directly. When Sensor A sees something that line goes from high to low. You can supply Vcc and ground from those pads, or the I2C header either one.&lt;/P&gt;&lt;P&gt;If you do it this way you don't need to know I2C at all.&lt;/P&gt;&lt;P&gt;Ringo</description><pubDate>Thu, 24 Apr 2008 11:12:24 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Your pic18f452 board is the master, so it needs the pullups. Use somehting around 1.5K or 1.8K on the slk and sda lines. without these it will not work at all.&lt;/P&gt;&lt;P&gt;As far as how to read and write it, just look back at my original code I posted and it will tell you.</description><pubDate>Thu, 24 Apr 2008 07:57:44 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>do i need the pullup resistors or is it possible that they are already built on to the sensor board becuase it does have a +5V connection too?&lt;br&gt;&lt;br&gt;this is the program i have tried on the PIC but it does not read the byte ...here i am trying to read the byte from the sensor and display that onto the 8 LEDs i have.....&lt;br&gt;&lt;br&gt;#include &lt;p18f452.h&gt;&lt;br&gt;#include &lt;i2c.h&gt;&lt;br&gt;&lt;br&gt;unsigned int value;&lt;br&gt;&lt;br&gt;void OpenI2C(unsigned char sync_mode,&lt;br&gt;unsigned char slew);&lt;br&gt;unsigned char WriteI2C(&lt;br&gt;unsigned char data_out);&lt;br&gt;unsigned char ReadI2C ();&lt;br&gt;void configure_LEDS(void);&lt;br&gt;void display_on_LEDS(unsigned char value);&lt;br&gt;&lt;br&gt;void main() {&lt;br&gt;&lt;br&gt;TRISCbits.TRISC3 = 1;&lt;br&gt;TRISCbits.TRISC4 = 1;&lt;br&gt;SSPCON1bits.SSPEN = 1;&lt;br&gt;&lt;br&gt;while(1) {&lt;br&gt;OpenI2C(MASTER, SLEW_ON);&lt;br&gt;SSPADD = 9;&lt;br&gt;&lt;br&gt;	StartI2C();&lt;br&gt;	WriteI2C(0x50);&lt;br&gt;	WriteI2C(0x01);&lt;br&gt;	RestartI2C();&lt;br&gt;	WriteI2C(0x51);&lt;br&gt;	value = ReadI2C();&lt;br&gt;&lt;br&gt;display_on_LEDS(value);&lt;br&gt;}	&lt;br&gt;&lt;br&gt;}&lt;br&gt;&lt;br&gt;void configure_LEDS(void) {&lt;br&gt;	TRISD = 0x00;&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;can u please give a brief explanation wht i should do ....like wht shud i write to the I2C bus and how can i read that byte from the address location of 0x50 on the sensor?&lt;br&gt;&lt;br&gt;Thank you</description><pubDate>Thu, 24 Apr 2008 05:28:31 GMT</pubDate><dc:creator>adilmemon</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>You can look at our Line Following Example program for our Serializer Lib MF &lt;A href="http://www.roboticsconnection.com/multimedia/libraries/MicroFramework/Documentation/index.htm"&gt;documentation&lt;/A&gt;, which shows logic you can use for performing line following.   However, like Ringo pointed out, line following speeds, etc. all depend on the physical robot configuration, which is up to you to figure out and spend time testing.&lt;/P&gt;&lt;P&gt;All the I2C information you need to interface the sensor is on the site for the Line Follower.  You just need to learn/read more about the I2C protocol and your compiler to understand how to query it.&lt;/P&gt;&lt;P&gt;Best Regards,</description><pubDate>Wed, 23 Apr 2008 10:55:00 GMT</pubDate><dc:creator>jsummerour</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>The ccs compiler is available from ccsinfo.com. I think the standalone version is around $100-$150.&lt;/P&gt;&lt;P&gt;If you have that compiler the code I gave you earlier will allow you to read the line sensor. I also told you in an email pretty much all you have to do to follow a line. I'm not going to give you a complete program for something that is a school assignment. Besides. something like line following is very individual depending on how the robot is built. A program for 1 robot will not work on another. You have to take into account where the sensor is placed, how fast the robot is, how demanding the course is etc.&lt;/P&gt;&lt;P&gt;Did you contact microchip and ask them about thier I2C routines?</description><pubDate>Wed, 23 Apr 2008 10:15:47 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Hello,&lt;br&gt;&lt;br&gt;I have tried every possible way i had....i have even put 1K pullup resistors but my program does not seem to work at all....&lt;br&gt;&lt;br&gt;can u please advise me a way how i can do this...my project deadline is not far and ill be screwed if i dont have this thing running....everything is done except for this sensor.&lt;br&gt;&lt;br&gt;is there a way i can download that CCS compiler or anything and can u please provide me with a program u mite have written in the past which does the same function as mine of following a line....please help ...it will be much appreciated. &lt;br&gt;&lt;br&gt;Thank you.</description><pubDate>Wed, 23 Apr 2008 09:11:51 GMT</pubDate><dc:creator>adilmemon</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Oh yeah, do you have pullups on both I2C lines? Somehting around 1.8K?</description><pubDate>Tue, 22 Apr 2008 18:28:22 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Just looking around the net I found this thread&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.robot-electronics.co.uk/forums/viewtopic.php?p=300&amp;amp;sid=67e9c8c9479b41ccb19f0c42d1a57aa6"&gt;http://www.robot-electronics.co.uk/forums/viewtopic.php?p=300&amp;amp;sid=67e9c8c9479b41ccb19f0c42d1a57aa6&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It mentions setting the I2C bus speed, which should be 100khz. How you set this depends on the freq of the crystal you are using with your pic.&lt;/P&gt;&lt;P&gt;See if this helps&lt;/P&gt;&lt;P&gt;Ringo</description><pubDate>Tue, 22 Apr 2008 08:46:49 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Im trying something lik this but this is not working? Do we have to set the pins as out/input of RC3,4&lt;br&gt;&lt;br&gt;&lt;br&gt;#include &lt;p18f452.h&gt;&lt;br&gt;&lt;br&gt;#include &lt;timers.h&gt;&lt;br&gt;#include &lt;i2c.h&gt;&lt;br&gt;&lt;br&gt;unsigned char value;&lt;br&gt;//void StartI2C(void);&lt;br&gt;//void StopI2C(void);&lt;br&gt;void OpenI2C(unsigned char sync_mode,&lt;br&gt;unsigned char slew);&lt;br&gt;unsigned char WriteI2C(&lt;br&gt;unsigned char data_out);&lt;br&gt;unsigned char ReadI2C (void);&lt;br&gt;&lt;br&gt;&lt;br&gt;void configure_LEDS(void);&lt;br&gt;&lt;br&gt;void display_on_LEDS(unsigned char value);&lt;br&gt;&lt;br&gt;&lt;br&gt;void main() {&lt;br&gt;&lt;br&gt;while (1) {&lt;br&gt;configure_LEDS();&lt;br&gt;&lt;br&gt;OpenI2C(MASTER, SLEW_ON);&lt;br&gt;//SSPADD = 0x50;&lt;br&gt;&lt;br&gt;StartI2C();&lt;br&gt;WriteI2C(0x50 +1);&lt;br&gt;value = ReadI2C();&lt;br&gt;&lt;br&gt;display_on_LEDS(value);&lt;br&gt;&lt;br&gt;//StopI2C();&lt;br&gt;&lt;br&gt;}&lt;br&gt;}&lt;br&gt;&lt;br&gt;	&lt;br&gt;&lt;br&gt;void configure_LEDS(void) {&lt;br&gt;	TRISD = 0x00;&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;void display_on_LEDS(unsigned char value) {&lt;br&gt;	LATD = value;&lt;br&gt;}</description><pubDate>Tue, 22 Apr 2008 08:28:12 GMT</pubDate><dc:creator>adilmemon</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>#Use is part of the CCS compiler. It just tells the compiler how to set up the I2C port. I'm not familiar with the C18 compiler, but I believe microchip has forums and I know they have a help system where you can talk or email a tech questions.   I just googgled "c18 compiler i2c" and it came up with lots of hits. Look for examples of code that talk to other devices, then just modify that to use the commands I listed above. This sensor is really eay to use since it only returns 1 byte, so any example you find should be good nough for you to modify.&lt;/P&gt;&lt;P&gt;Ringo</description><pubDate>Tue, 22 Apr 2008 07:57:57 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>What is #use in C code?</description><pubDate>Tue, 22 Apr 2008 07:21:05 GMT</pubDate><dc:creator>adilmemon</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>We are using a c18 compiler to compile the C-code in microchip mplab ide</description><pubDate>Tue, 22 Apr 2008 06:19:33 GMT</pubDate><dc:creator>adilmemon</dc:creator></item><item><title>RE: I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>If you are using the CCS compiler for the 452 then you must set up your I2C like this&lt;/P&gt;&lt;P&gt;#use I2C(master, sda=PIN_c4, scl=PIN_c3,slow)&lt;/P&gt;&lt;P&gt;Then to read the sensor use&lt;/P&gt;&lt;P&gt;        i2c_start();   // start condition&lt;BR&gt;        i2c_write(ADDRESS + 1);&lt;BR&gt;        value = i2c_read(0);&lt;BR&gt;        i2c_stop();&lt;BR&gt;&lt;/P&gt;&lt;P&gt;where address is the address of the line sensor you are using.&lt;/P&gt;&lt;P&gt;If you are using a different compiler or language then you will have to port this over to it.&lt;/P&gt;&lt;P&gt;This will return a byte with either 5 or 7 bits set according to teh sensor status. If you have an older line sensor, it will have 5 bits, if it is a newer sensor with the holes on teh left and right to mount extra sensors then it will return 7 bits.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Ringo&lt;/P&gt;&lt;P&gt;Ringo</description><pubDate>Tue, 22 Apr 2008 06:14:27 GMT</pubDate><dc:creator>ringo</dc:creator></item><item><title>I2C Line Following Sensors Help</title><link>http://www.roboticsconnection.com/userForums/Topic393-10-1.aspx</link><description>Hi all,&lt;br&gt;I currently got the sensors after a long wait but after a lot of reading in the data-sheets, I couldn't know how to use the sensors.&lt;br&gt;Can anyone help me in reading the output of the sensors.&lt;br&gt;I use a PIC18F452 microcontroller. I have to follow a white line on a black floor. There are some turns. &lt;br&gt;The main problem is how to read the byte.&lt;br&gt;Please give me some example program.&lt;br&gt;Regards</description><pubDate>Tue, 22 Apr 2008 05:33:31 GMT</pubDate><dc:creator>adilmemon</dc:creator></item></channel></rss>