View previous topic :: View next topic |
Author |
Message |
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
I2C to USB |
Posted: Thu Jul 16, 2020 11:14 am |
|
|
Hi all,
Do you know of any product that I can use in order to use my computer as a I2C master via USB? I would use it to test out products without having to go through a hardware setup with another PIC saving myself another layer of debug, possibly.
I'm thinking of a combination of Realterm with a FT232RL, but for I2C instead. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Thu Jul 16, 2020 12:43 pm |
|
|
Look at the one RobotShop does.
Has a nice simple command interface so makes setting up the PC end
relatively easy.
<https://www.robotshop.com/uk/devantech-usb-to-i2c-module.html?utm_source=google&utm_medium=surfaces&utm_campaign=surfaces_across_google_uken&gclid=EAIaIQobChMI3L_jhrbS6gIVyIBQBh2ZHQHOEAQYBSABEgITTPD_BwE> |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Thu Jul 16, 2020 12:51 pm |
|
|
Thanks, that's a good reference. I'll look for a version that maybe lets me select between 5V or 3.3V |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Fri Jul 17, 2020 12:47 am |
|
|
Problem is that to do 3.3v as well, would need a regulator, and really the
ability to change the pullups used as well. Starts to get complex. Saida
do a USB module with the two voltage option, but it doesn't allow these
other settings. Instead it relies on you providing the voltage and the
pullups. Chinese and possibly dubious quality.
Diolan do a number of modules with all these options, but they are
harder to drive than the Devantech module, and more expensive....
<https://diolan.com/usb-i2c-adapters-comparison> |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Fri Jul 17, 2020 4:28 am |
|
|
Ah, yet another 5v vs 3v problem.....
Since this is for testing on your PC, I suggest TWO interface modules.
Put a green dot on the 5 volt device, an orange dot on the 3 volt device.
That makes it obvious what voltage they are and should eliminate 'bad puffs of smoke '..
Jay |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Fri Jul 17, 2020 8:25 am |
|
|
Alright thanks for these suggestions... I'll have to take some time to look through each of the specs. |
|
|
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Sat Jul 25, 2020 6:53 am |
|
|
www.i2cchips.com have a bl233b chip for $4. Looks like a preprogrammed PIC to do the serial<>I2C work.
looks like a fairly easy/simple/effective way to get what you want.
I'd still have 2 though, one 'green' one for 5 volt, one 'orange' for 3 volt.
Jay |
|
|
drh
Joined: 12 Jul 2004 Posts: 192 Location: Hemet, California USA
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Sat Jul 25, 2020 9:46 am |
|
|
yeesh that's kinda pricey...$300 when you can use a $2 USBTTL module and a $1 PIC....
yup, I'm old and frugal....still like Assembler too ! |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Sat Jul 25, 2020 9:55 am |
|
|
Yes, that's a bit steep. But my idea with this was to use it for testing i2c devices with a known master hardware setup that I can be certain is working correctly.
Perhaps I should just make my own with a computer GUI that allows me to program send a list of i2c via UART. I could possibly even provide my own jumper to select between 5v or 3.3v levels. If I'm reading this right, if I use something like the PIC16F19156/another one in that family, I can still run at full speed when powering at 3.3v. Is there a reasoning flaw there?
This actually sounds like a practical project that could be quite fun to do... Since I'm in no rush, I might put this aside as an idea. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Sat Jul 25, 2020 10:41 am |
|
|
No reasoning flaw, but the hardware may be slightly more complex than
you think, and then you have the decision of the command language to
use.
Hardware more complex, since you will have to deliver the powrr to the
usb buffers correctly for both voltages. The setup is normally different
for 5v and 3.3v operation. |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Sat Jul 25, 2020 10:50 am |
|
|
Thanks for the warning :P
Yes, I would need to write my own set of UART messages to send around, although I have already written a pretty robust library for message buffers and parsing so I just need to figure out _what_ to send from my GUI.
As for the USB side, I was thinking of using something like a 5V version of the Sparkfun FTDI Basic. That could provide the input voltage to a 3.3V LDO on my board, right? (so actually not a truly self contained board)
Then a jumper can be used to set the the 5V or 3.3V for I2C pullups and the slave power.
If I use a PIC24, there are 3.3V MCUs with 5V tolerant pins, so I could remap and use those for the UART and SPI. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Sat Jul 25, 2020 11:50 am |
|
|
A 5v tolerant pin, doesn't give the switching needed for 5v I2C.
The PIC's operating voltage has to physically change to 5v and to 3v. |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Sat Jul 25, 2020 11:52 am |
|
|
Ttelmah wrote: | A 5v tolerant pin, doesn't give the switching needed for 5v I2C.
The PIC's operating voltage has to physically change to 5v and to 3v. |
Oh, I thought that if I simply pulled a voltage up to 5V, then it would pass that threshold required for a high voltage regardless of the PIC power, and low voltage would simply be zero.
I guess I do need to think about it some more... |
|
|
|