Git Product home page Git Product logo

rpi-i2c-joystick's Introduction

RPI-I2C-Joystick

I2C Arduino based joystick for Raspberry Pi in order to be used with RetroPie. The Arduino is also used to control audio volume and power management (switch the Raspberry Pi on and off).

Aruino

  • The arduino (an ATMega328 running with its internal 8Mhz clock) is used to control the Raspberry Pi. It's used to read joystick buttons and analog axis.
  • The board directory contains the schematic (and pcb), compatible with raspberry Pi GPIO. THIS IS A WORK IN PROGRESS!!! By now it's tested on a breadboard.
  • The i2c_gamepad directory contains the actual arduino code.

hardware

The hardware directory contains the definition for the ATMega328 without quartz configuration (and PINB6 and PINB7 enable).

schematic pcb

Raspberry Pi

power

In order to know when the raspberry pi has been shutdown, the gpio-poweroff overlay is used. This is the /kill signal going to the arduino (HIGH when the raspberry pi is halted).

In /boot/config.txt:

dtoverlay=gpio-poweroff,gpiopin=4,active_low="y"

joystick

The driver directory contains the code of the user space uinput driver for the arduino I2C joystick.

Display Configuration

I use a 4.3" 480x272 TFT display using composite video (maybe the worst quality possible). It would be better to use a DPI interface (with the GPIO, an HDMI to DPI converter, or a DSI to DPI converter).

Here's my video and overscan settings in /boot/config.txt

disable_overscan=1

overscan_left=34
overscan_right=20
overscan_top=16
overscan_bottom=20
overscan_scale=1

# set the frame buffer to match the tft resolution
framebuffer_width=480
framebuffer_height=272
framebuffer_depth=24

# use PAL, it seems way better than NTSC!!
sdtv_mode=2

# 16:9 aspect
sdtv_aspect=3

In order to setup the overscan settings, I used https://github.com/popcornmix/set_overscan, and then tweaked the values by hand.

rpi-i2c-joystick's People

Contributors

konsumer avatar pilochambert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpi-i2c-joystick's Issues

Question about I2C driver for this joystick

Hi, I wanted to assembly joystick according to your project. I'm having a problem with the driver. It compiled, but the device is still not available. Maybe I did something wrong, help me figure it out please.

Question: serial comm

Hi,
I like the design of the board, but I was thinking I could free up 2 more IO pins from arduino if I used the RX/TX instead of i2c to talk to pi, and this would also allow me to write the "firmware" from pi, and allow other styles of firmware like firmata (keep logic in the driver, and the Arduino is just used for it's GPIO.) Do you have any opinions on this? Am I wrong about this as an alternative?

Hardware Images

Great project!

I like to see schematic/PCB without loading it up into a viewer. It can be really nice just right in the README file. If you are interested, I can PR for these in README:

scehmatic

layout

I made these in altium viewer

Error at void requestEvent()

I'm not the most adequate with Arduino and it's code, so I can't fully figure it out, though it seems to be a false value reading. the line of code it refers to is at the very end.

i2c_gamepad.ino: In function ‘void requestEvent()’:
i2c_gamepad.ino:346:64: error: invalid conversion from ‘char*’ to ‘const uint8_t* {aka const unsigned char*}’ [-fpermissive]
In file included from i2c_gamepad.ino:1:0:
/usr/share/arduino/libraries/Wire/Wire.h:61:20: note: initializing argument 1 of ‘virtual size_t TwoWire::write(const uint8_t*, size_t)’
virtual size_t write(const uint8_t *, size_t);
^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.