Monday, November 19, 2012

Raspberry Pi I2C

I have a Raspberry Pi and lets face it, who doesn't?

I have played with linux on many architectures before including PPC, Hitachi, MIPS, PA-RISC and Sparc so I figure I had better have a go at ARM too.

Apart from playing around, I plan to create a light controller module for my garden lights. This will require some hardware hacking which is always a bit of fun but my main plan is to bring it together with some fancy software.

In previous projects I have interfaced with GPIO and I2C to run door controllers and read swipe cards (Mostly on the WRT54G).

I could not find accurate instructions for getting I2C going on the rpi so here are my instructions for users for raspbian:

Install some tools
# apt-get install i2c-tools

edit  /etc/modprobe.d/raspi-blacklist.conf and comment out the line


i2c-bcm2708

I don't know why it comes as blacklisted.

edit /etc/modules and add the lines
i2c-bcm2708
i2c-dev
This will make sure the drivers are loaded during the boot.

create a file /etc/udev/rules.d/99-i2c.rules and add the line
SUBSYSTEM=="i2c-dev", MODE="0666"
This will give all users access to the i2c devices. You could instead set the owner or group but the rpi is not normally being used as a multi-user device

Now you can test these changes without a reboot:
modprobe i2c-bcm2708
modprobe i2c-dev
udevadm trigger
ls -l /dev/i2c*

And you should see output like this (Your date will be different):
crw-rw-rwT 1 root i2c 89, 0 Nov 18 22:36 /dev/i2c-0
crw-rw-rwT 1 root i2c 89, 1 Nov 18 22:36 /dev/i2c-1

If that works, reboot and run the ls again. The devices should be there and have world read/write permissions.

Now, to connect up some hardware and show that it works. Look for a new blog soon.

26 comments:

  1. Thanks for posting this! Did not know about 99-i2c.rules, and the ability to have those permissions set on boot.

    ReplyDelete
  2. I recommend reading it to the end. Rita

    ReplyDelete
  3. The information you shared is very helpful to us. friv 4 school

    ReplyDelete
  4. Raspberry Pi 3 supports I2C communication. ... In this post, we will make a simple I2C demonstration with Raspberry Pi3 as a single master and two Arduino UNO devices as slaves. So this will be a single master, two slave setup--Click here

    ReplyDelete
  5. Very good post . I certainly love this ưdownload. Keep writing!

    ReplyDelete
  6. Thank you for sharing this relevant content.

    roofrepairathens.com

    ReplyDelete
  7. great site information, I am having an issue with the mother board of my mini computer.And I don't know how to fix it. Feels great I have this information.

    https://minneapolisstpaulrealtor.com

    ReplyDelete
  8. great site information, Glad that I found this! Plumber Near Me

    ReplyDelete
  9. I think this information that you have shared with us is really worth sharing. Thank you for this. - Best Dumpster Rental

    ReplyDelete
  10. Wow, these are actually great information about Linux. I am actually doing a dual boot up and I hope that this information that you've just shared is also going to work on my computer. Thank you again, landscapinginelpaso.com

    ReplyDelete
  11. So that's how it is fixed. Thanks for this, we will use this on our site here: www.poolbuildernaplesfl.com

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. recently switched to linux! I'm really dumbfounded and I don't know which is which. Thanks for sharing this. Cheers from us at generalcontractoringreensboronc.com.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. linux is a good place to start out programming. Yes, Linux actually is an OS that is good for complex work such as programming. Cheers from roofingwarwickri.com.

    ReplyDelete
  16. During the printer establishment, numerous user see the 'Epson Printer WiFi Setup Failed' message springing up on the screen. The error message showing up on the screen demonstrates that your Printer Wi-fi setup is flopped because of some specialized difficulty. Luckily, a user can undoubtedly manage issues with basic apparatuses. Epson printer wifi connection problem On the off chance that your printer is also showing you the 'Epson Printer WiFi Setup Failed' message on the screen, you can continue with the directions referenced in the guide and fix your concern. Along these lines, on the off chance that you would prefer not to return to your old-wired association, peruse and adhere to the guidelines. Assuming you are stressing associating your Epson printer to the remote organization, we will assist you with doing that. Here you can figure out how to set up an Epson printer remotely with no outer assistance. In the wake of introducing the product furnished with your new printer, you can go before setting up your printer to work remotely user WLAN network. This availability doesn't need links and it offers arrangement without the capability of network disappointment. brother printer MFC L2750DW setup

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. I appreciate the information on this website. I like it. Thanks for sharing! By the way, please visit our website to avail an affordable GMB services for your website.

    ReplyDelete
  19. I can't wait to see that post. Anyway, I'm really interested of using a Linux OS in one of my computers. I just hope someone could help me install such. In the meantime, please visit www.carpetcleaningelpasotx.net and avail the best carpet cleaning services that we offer to residents and business owners in El Paso, TX.

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete