4

noob here

So I managed to get my circuit to be a standalone circuit (as pictured below). I want to use this circuit as an input to a game on my computer. What I want to know is could this micro-usb breakout board https://www.diyelectronics.co.za/store/breakout-boards/2414-micro-usb-power-switch-breakout-module.html be used to communicate with the computer. Where would the data pins (d+/d-) connect to the atmega328?

Any help will be most appreciated circuit

user19964
  • 61
  • 1
  • 6
  • ATmega328p is not a right choice for a game controller. from the ATmega family ATmega32u4 would be better (Arduino Leonardo and Micro). it has native USB with HID capability. but it is not available as DIP package – Juraj Dec 03 '19 at 05:32
  • @Juraj So I would need a breakout board for the ATMEGA32u4? – user19964 Dec 03 '19 at 05:36
  • Arduino Micro is a breakout board for 32u4. Micro Pro is even more compact (without the ICSP header) – Juraj Dec 03 '19 at 05:37
  • @Juraj Ah okay, I will consider this option: thank you. – user19964 Dec 03 '19 at 05:42
  • as I read in comments that it is a controller for a game you develop, then you can of course implement a basic Serial communication between your sketch on Arduino and your PC application – Juraj Dec 03 '19 at 10:14
  • @Juraj I wouldn't be able to use the Atmega328 though right? If I want serial communication? – user19964 Dec 03 '19 at 11:54
  • not without an USB adapter chip – Juraj Dec 03 '19 at 11:58
  • @Juraj okay in that case it might be better if I use bluetooth then. Thank you for your help – user19964 Dec 03 '19 at 12:01

1 Answers1

2

The ATmega328 does not have any native USB capability, so there is nowhere appropriate to connect D+/D- to the ATmega328.

Assuming you are emulating an Arduino Uno, then something like this:

https://www.jaycar.com.au/arduino-compatible-usb-to-serial-adaptor-module/p/XC4464

is what will come closest to mimicking the USB function on an Uno (ie a serial connection).

This shows how such a device would be connected:

https://www.jaycar.com.au/usb-serial-converter

user85471
  • 721
  • 3
  • 7
  • Oh, so basically without a usb to serial adaptor, this won't be possible? Thank you for saving me time @user85471 – user19964 Dec 03 '19 at 05:04
  • Yep. Long answer is that there may be a software USB implementation that allows this but you're better to look at something like an ATmega32u4, which is what is on a Leonardo, but they only appear to come in surface mount packages (but breakout boards exist). – user85471 Dec 03 '19 at 05:10
  • does the ATMEGA32u4 have native usb capability? @user85471 – user19964 Dec 03 '19 at 05:25
  • Something else to think about, there are many USB protocols. The linked to item in the answer likely uses a USB serial protocol. Keyboards use a USB human interface protocol. I assume gaming consoles which connect to computers using a USB port also use the USB human interface protocol. So the linked to device may not work. – st2000 Dec 03 '19 at 05:26
  • You need to look at the chip specifications here. In the specifications it says: "Complies fully with Universal Serial Bus Specification Rev 2.0". However, note, that does not say what USB protocol is supported. That is up to the software. You need to do some leg work and figure out which USB protocol your game pad is using. Or if you can use your keyboard as the gaming input. – st2000 Dec 03 '19 at 05:29
  • @st2000 hmm these are all factors I hadn't considered, admittedly. Just to clarify, however, this circuit is the input to the game and the game is a game that I am developing. I am exploring communication types for my game and have explored bluetooth, now I want to see if i could use USB – user19964 Dec 03 '19 at 05:50
  • Bluetooth like USB can contain many protocols. Listening to stereo, talking on the phone and using a keyboard all use different Bluetooth protocols. You need to narrow your question down to the specific protocol your game will use. – st2000 Dec 03 '19 at 06:51
  • @st2000 Also true. I have used the bluetooth module HC-06 before for a very similar project. How would I know what protocol that falls into? – user19964 Dec 03 '19 at 15:06
  • I want to say "HC-06 Bluetooth serial..." which I just copied from the aliexpress web page. Check this wikipedia.org page for a list of bluetooth protocols. Most of the time, when people are creating projects, it is easiest to use the serial protocol embedded into Bluetooth or USB protocols. But, as you might already know or have a feel for, sending music, for example, this way would not work very well. – st2000 Dec 03 '19 at 22:12
  • There are way cheaper ones on eBay. Search "USB Serial" on eBay. In 2014, I used them without any issue. You have to order few more than you need, because some of them are DOA. It is an old question, still some people stumble on this question. – Manir Apr 12 '21 at 15:44