Author Topic: I need a tiny usb host microcontroller that outputs i2c  (Read 2665 times)

0 Members and 1 Guest are viewing this topic.

Offline VinnyVieleTopic starter

  • Newbie
  • Posts: 8
  • Country: us
I need a tiny usb host microcontroller that outputs i2c
« on: January 16, 2023, 10:25:59 pm »
I need a microcontroller that will allow me to plug in a keyboard via a usb port, (I have USB A Female to MicroUSB adapters if need be) and then transfer the keypresses over to my microcontroller that I have via i2c. Does anyone know of a board that can do this? I can’t add a USB host shield to my main microcontroller because I have a Gameduino on it. Thanks!

Edit:

I’m probably going to follow this tutorial:
https://youtube.com/playlist?list=PLVfmdw6Y3COp4Via7KergjVs8i194ffJS

It’s for making a Bluetooth USB relay, but I can modify it and connect it to i2c to achieve what I want to do.

It uses a Arduino Pro Mini and a Mini USB Host Shield 2.0
« Last Edit: January 17, 2023, 02:16:34 am by VinnyViele »
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 6389
  • Country: ca
  • Non-expert
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #1 on: January 16, 2023, 10:30:37 pm »
Almost every USB mcu dev board in existence is capable of this.

Unless you are talking about specifically one that has PC side support software already ready to go.

https://www.eevblog.com/forum/beginners/linuxwindows-compatible-usb-or-rs232-i2c-tool/
https://ca.robotshop.com/products/usb-to-i2c-converter
https://www.adafruit.com/product/2264
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline VinnyVieleTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #2 on: January 16, 2023, 10:42:30 pm »
Sorry, I was referring to a microcontroller that supports plugging a USB keyboard into it and the key presses are sent over to my other microcontroller by i2c. I’ll update the post
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 6389
  • Country: ca
  • Non-expert
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #3 on: January 16, 2023, 11:16:39 pm »
Since you mentioned the shield: https://docs.arduino.cc/retired/shields/arduino-usb-host-shield
any arduino board that supports that shield is going to also have i2c as well, and would work.

But this seems like a complicated solution, or at least, one that will be fairly complex to execute.

https://microcontrollershop.com/default.php?cPath=154_170_273
https://www.sparkfun.com/products/9947

What is the base arduino board being used, is it a regular 8bit board?
If you have something like Arduino Due it can be configured to run as a USB host, without needing any additional expansion board. Maybe other models exist as well.
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline VinnyVieleTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #4 on: January 16, 2023, 11:23:36 pm »
I’m actually using an Adafruit Metro M4 running CircuitPython.

I want to know where to get another board that can take a USB keyboard and communicate with my Metro over I2C, (I can’t attach a shield because I’m already using another shield for graphics)
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #5 on: January 16, 2023, 11:29:56 pm »
I’m actually using an Adafruit Metro M4 running CircuitPython.

I want to know where to get another board that can take a USB keyboard and communicate with my Metro over I2C, (I can’t attach a shield because I’m already using another shield for graphics)

The MCU on this board (ATSAMD51) has a USB OTG controller and can act as a USB host directly. Why use a separate chip and go through I2C? (My guess is that either you didn't know this MCU was capable of that, or you don't know how to program it to do that. Now to be checked is whether this Adafruit board itself does support USB host.)
 

Offline VinnyVieleTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #6 on: January 16, 2023, 11:39:23 pm »
Because I’m running CircuitPython and they haven’t added support for the port to act as a host
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #7 on: January 16, 2023, 11:51:33 pm »
PIC24FJ64GB002 has USB OTG & I2C. QFN28 if you want it small, SOIC or even DIP28 if you don't.
Doesn't even need a crystal to do USB.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 6389
  • Country: ca
  • Non-expert
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #8 on: January 17, 2023, 12:00:22 am »
https://github.com/gdsports/USB_Host_Library_SAMD library here but its not circuitpython

It looks like the cpython USB host support is very recent, so many you can search through and see what it supports: https://www.hackster.io/news/circuitpython-7-3-0-release-candidate-brings-usb-host-support-raspberry-pi-rp2040-pio-improvements-c928e6c1ef92
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: SiliconWizard

Offline VinnyVieleTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #9 on: January 17, 2023, 12:13:04 am »
I have a Gameduino on my m4 and I can’t attach any other boards, and that library needs me to attach a usb shield. Which I can’t do. I am asking for a tiny microcontroller that I can plug a keyboard into that I can use i2c to talk to my m4.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #10 on: January 17, 2023, 06:09:18 am »
It might be possible to use an Attiny85 and bit bang the USB host part. Or if possible bit bang it on your current board. Only has to do the slowest USB variant since keyboards are slow.

But another option might be to use the PS/2 interface option. Not sure if modern USB keyboards still have this option. Could be worth to investigate this. Only takes two pins to interface with it.

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #11 on: January 17, 2023, 09:04:08 am »
Does it have to be USB? Many older keyboards support both USB and PS2, the latter being a simple SPI-like prototcol
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline VinnyVieleTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #12 on: January 17, 2023, 01:43:56 pm »
PS/2 uses 8 bit words and i2c uses 7 but words
 

Offline gamalot

  • Super Contributor
  • ***
  • Posts: 1306
  • Country: au
  • Correct my English
    • Youtube
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #13 on: January 17, 2023, 01:53:12 pm »
RP2040 (Raspberry Pi Pico) is one of the most available and cheap.

Offline Skashkash

  • Regular Contributor
  • *
  • Posts: 118
  • Country: us
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #14 on: January 17, 2023, 02:01:52 pm »
I think Mike's suggestion is to bit bang the PS2 keyboard protocol on the I2C or two other pins.

You may already have PS2 support on your board with CP support.

https://docs.circuitpython.org/en/latest/shared-bindings/ps2io/index.html#module-ps2io

As another alternative, a raspi pico could act as a USB HID host.
There are some examples out there, but you'd need to add the USB connectors.
 

Offline spostma

  • Regular Contributor
  • *
  • Posts: 118
  • Country: nl
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #15 on: January 18, 2023, 07:22:50 pm »
I would suggest the very cheap CH554 or CH559 20-pin controllers with 8051 core that can be programmed using Keil or SDCC:
https://hackaday.com/tag/ch554/
https://github.com/HonghongLu/CH554
https://github.com/Blinkinlabs/ch554_sdcc
https://github.com/ole00/ch554_sdcc_usb_blinky

A long German forum thread with lots of know-how info on this processor:
https://www.mikrocontroller.net/topic/462538?page=single
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #16 on: January 18, 2023, 08:03:47 pm »
I would suggest the very cheap CH554 or CH559 20-pin controllers with 8051 core

Interesting devices with USB 2.0 full speed device and host support, but a quick look at the information on the wch website shows no I2C interface  :o
Did not look at the datasheet if one of the serial interfaces supports it, but it can of course easily be bit banged.

http://www.wch-ic.com/products/CH559.html
http://wch-ic.com/products/CH554.html

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #17 on: January 18, 2023, 08:31:48 pm »
Hardware guys often want to rely on software to ease their pain, and software guys often want to rely on hardware to ease their pain. Always like that.
This is how we end up requiring 32GB of RAM to run a word processor. ^-^

If you used C instead of CircuitPython, you could use tinyusb for the USB host side and would not need any additional hardware.
 

Offline VinnyVieleTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #18 on: January 18, 2023, 08:37:04 pm »
I wish I could, but it’s not that simple.
I’m making an OS with it and the way that Arduino works, it would be impossible to execute external binary files from an SD, but I found a way to do it on CircuitPython.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #19 on: January 19, 2023, 07:00:12 am »
If you used C instead of CircuitPython, you could use tinyusb for the USB host side and would not need any additional hardware.

Or should he wait for IPL to be finished and all his problems will be solved  :-DD :-DD

p.s. The I stands for Imperium until it changes again of course.  :palm:



Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: I need a tiny usb host microcontroller that outputs i2c
« Reply #20 on: January 19, 2023, 07:33:12 pm »
If you used C instead of CircuitPython, you could use tinyusb for the USB host side and would not need any additional hardware.

Or should he wait for IPL to be finished and all his problems will be solved  :-DD :-DD

p.s. The I stands for Imperium until it changes again of course.  :palm:

 ;D
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf