USB to PCA9685 (Controlling PWM signals via usb)

Hello,

I’m currently trying to design a board that will talk to several other boards via USB. The thought process behind it is eventually being able to use USB, RF, or be able to interchange boards to the Arduino. Right now I’m working on lighting. I want to have a shield with several USB ports that communicates with the Arduino. The USB connects to a second board with LED drivers. Since I need logic PWM, I was looking at the PCA9685. On the LED end, I was planning on using a circuit like the circuit I attached.

The connection on the Arduino side would be like the USB side of the circuit, but connect to the I2C pins instead.

So with this, I have a couple questions:

  1. Would a circuit like this work? I haven’t really played with USB connections especially with Arduino, so I’d like to use this project to learn.

  2. How many USB connections can I create with the Arduino? Am I able to make a soft I2C or USB with two arbitrary pins?

  3. With this being converted to a USB connection, potentially could I also plug this into a PC and control my lights directly without the Arduino?

8f501302f6aead20d6e1e409a098f6bd6665f49c.jpg

Can you really connect an USB signal to a ATtiny45 with just a couple resistors? I have a hard time believing this is possible.

Endevor:
Am I able to make a soft I2C or USB with two arbitrary pins?

You should be able to bit bang I2C on any pair of pins capable of digital output (which I believe is all the I/O pins) but I’m not aware of any Arduinos capable of software USB.

You want to communicate between boards with USB? Do I understand you correctly?

USB is a necessary evil when working with a PC. IMO, it should be avoided when possible. USB has a lot of overhead and it not a good protocol to use for communication between microcontrollers.

DuaneDegn: Can you really connect an USB signal to a ATtiny45 with just a couple resistors? I have a hard time believing this is possible.

That's what I was curious about. I'm no circuitry expert so I wanted advice before I tried to put this together. I looked up the schematic for the PCA9685 from a small chip they have at adafruit and I fount a USB conversion schematic online that converted it to I2C, so I thought I could simply slap the SDA/SCL connections into the PCA9685. If that doesn't work, then I obviously need to find another solution.

The thought I had with USB was to have a cable that was virtually available everywhere instead of having 4 different cables connected. Right now I have several different cables for various connections (I honestly can't remember the technical names of a couple of them). The lighting has a RJ45 connection right now with 7 of the Arduion PWM signals going through. I thought it would be easier to instead send a simple cable with only two pins to a PCA9685 and generate the PWM on board. Having the USB protocol would enable to plug the device into a PC for alternate control, and even more (and dreaming a little into the future) plug in two bluetooth or RF dongles to make it wireless.

While typing this, the thought kind of occurs to simple keep the I2C protocol, ignore functionality for the PC. I could technically still use the USB connector if I want, but it wouldn't be true USB... I'm assuming that would also ruin the potential Bluetooth or RF via those ports.

Yes you can connect an I2C device to a USB host device if you use the right chip. Like this:- http://www.robot-electronics.co.uk/usb-iss-enhanced-usb-i2c-module.html

No you can not connect a USB device to an ATtiny45 in any way.

The only way to get an Arduino to act as a USB host is to get a host shield. This is one USB device only. Talk of having 4 USB hosts on one Arduino is misguided.

Alright, so I want to approach this differently then. Bear with me too, still learning these protocols.

I need to connect to at least 3 other devices in some fashion. From what I've seen, RF seems to be easier to handle than bluetooth.

SPI seems to handle mutliple devices easier than I2C, so if I wanted to connect to 3 devices to my arduino wirelessly and control them virtually simultaneously, how would I go about doing that? I had added a xbee slot on my circuit for the original idea of making it bluetooth using: RN42-XV. Can xbee connect to multiple devices?

Bottom line, I want to get some sort of signal to my other devices, wither I2C, SPI, something to control some LED drivers on one device, a power relay switch on another, and receive sensor results from another. (So two way wireless comms.)

What is the best protocol to use and the best way to make it wireless? Would it be easier to use several arduino boards to talk wirelessly? Would that be something xbee could handle?

Or making the serial wireless.... Especially with 3 serials already on a mega.

Endevor: RF seems to be easier to handle than bluetooth.

By "RF" you mean Radio Frequency? If so, Bluetooth is a RF device.

Using HC-05 modules makes using Bluetooth pretty easy but then there are lots of easy ways to communicate between boards.

Endevor: SPI seems to handle mutliple devices easier than I2C, so if I wanted to connect to 3 devices to my arduino wirelessly and control them virtually simultaneously, how would I go about doing that?

I suppose it depends on what "virtually simultaneously" means.

I don't understand your reference to I2C and SPI and "wirelessly" in the same sentence. Do you want to interface with the wireless device with I2C or SPI.

Endevor: Can xbee connect to multiple devices?

Yes. At least with the Zigbee versions you can. You could use a "broadcast" address to send a message to all the XBees using one particular system address (I forget the correct term).

Most wireless devices can transmit to multiple devices one after the other.

XBees are nice but expensive. IMO, there are lots of less expensive options which work nearly as well (or perhaps better).

Endevor: Bottom line, I want to get some sort of signal to my other devices, wither I2C, SPI, something to control some LED drivers on one device, a power relay switch on another, and receive sensor results from another. (So two way wireless comms.)

What is the best protocol to use and the best way to make it wireless? Would it be easier to use several arduino boards to talk wirelessly? Would that be something xbee could handle?

I2C and SPI are wired protocols. You keep mixing them in with wireless communication.

IMO, you should either use the $2 nRF24L01+ modules or Bluetooth modules. At least these two options won't cost much. You can get HC-05 modules on ebay for $4. The HC-05 modules can act as either a master or a slave device. HC-06 modules are slave devices only.

Bluetooth is generally one to one communication. I believe you could change the target Bluetooth module from within the program but I've never done this myself. I have used nRF24L01+ modules to transmit to multiple targets so I know this is possible. I'm 98% sure it's also possible with HC-05 modules.

The RN42-XV or XBee devices would also be an option but they cost a lot more. I don't think these other devices are worth the extra expense.

DuaneDegn: I don't understand your reference to I2C and SPI and "wirelessly" in the same sentence. Do you want to interface with the wireless device with I2C or SPI.

The devices at the other end will use the wired protocol, i.e. the PCA9685 would take I2C. How would I go about getting a signal from the Arduino over there wirelessly.

DuaneDegn: By "RF" you mean Radio Frequency? If so, Bluetooth is a RF device.

I keep hearing them as separate things, hence me referring to them as that. Makes sense though.

Bluetooth is generally one to one communication. I believe you could change the target Bluetooth module from within the program but I've never done this myself. I have used nRF24L01+ modules to transmit to multiple targets so I know this is possible. I'm 98% sure it's also possible with HC-05 modules.

The first attempt was to use bluetooth, but I couldn't find anything online where they connected to more than one device, even in sequence, one after the other.

So, I can use the nRF24L01+, get 4 of them, one for the Arduino and the others for the 3 sub devices and I'm assuming you simply connect to 1 at a time, just go one after another. And I could control all 3 devices with the arduino. Would the code in the background look like I was just talking to a SPI device or would I have to add something for the wireless?