Sending data from PC to multiple Thing Devs in realtime

All things pertaining to wireless and RF links

Moderator: phalanx

Post Reply
zhulien
Posts: 11
Joined: Wed Mar 07, 2018 1:07 am

Sending data from PC to multiple Thing Devs in realtime

Post by zhulien » Wed Mar 07, 2018 1:22 am

Hello.
I am doing a project where I need to send data from my PC to multiple Sparkfun Thing Devs based on conditions. The data is in the same format every time and for every board and consists of a couple of numbers. The thing is I need to send such type of data a couple times a second because I need to have real-time response in the boards(in the range of milliseconds). Basically, the project is music related and I am analyzing sound on my PC and I need to sent the data to the boards and react at realtime. I need the communication to be wireless and I need to be able to address the different boards separately.

Can you guide me with some possible(and fast) solutions about the topic. I act to the data I receive a couple times a second, thus the realtime aspect. I thought of using messaging queues, but I didn't find a viable solution. The server solution seems slow for the purpose. Also, I would like to be able to program the Thing Devs wirelessly, but I suppose this is more of an ESP topic. Thank you!

Valen
Support Volunteer
Posts: 1715
Joined: Wed Dec 22, 2010 2:05 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by Valen » Wed Mar 07, 2018 8:52 am

There is a multicast IP protocol to send data from one to many. But I don't know how this works with ESP8266 and Sparkfun Things. You might want to research that and look for others that have done projects based on this:

https://en.wikipedia.org/wiki/IP_multicast

zhulien
Posts: 11
Joined: Wed Mar 07, 2018 1:07 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by zhulien » Thu Mar 08, 2018 8:45 am

I actually need the simplest possible solution, just need the data to be received in a margin of milliseconds after the send. Considering it is 5-6 integers(even shorts as the maximal value is 4095) the payload will be around 20-24 bytes per packet. Like I said, I need this to happen a couple times a second though.

Valen
Support Volunteer
Posts: 1715
Joined: Wed Dec 22, 2010 2:05 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by Valen » Fri Mar 09, 2018 9:07 am

Have you tried the unicast approach? Sending each Thing a packet in turn and change IP addressing to the next one. What was the rate achieved?

Bandwidth-wise that should not be a problem for multicast. As long as the wifi network isn't congested. Finding the right library or code that does multicast-networking together with the AT-commandset in the Things might not be so simple. Again, haven't done any of this with ESP8266s, in arduino-mode or AT-mode. Can't help with the details.

zhulien
Posts: 11
Joined: Wed Mar 07, 2018 1:07 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by zhulien » Mon Mar 12, 2018 1:32 am

Thank you for the input. I haven't tried multicasting because it seems to me as a bit overkill, especially, like you said, in finding the proper library to do so. I investigated a bit more and I will try doing it with messaging and MQTT. I'll host a broker on my PC and I did find an easy to use library for ESP/Arduino which will act as the subscribers.

zhulien
Posts: 11
Joined: Wed Mar 07, 2018 1:07 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by zhulien » Tue Mar 13, 2018 8:57 am

So, this might be for another thread but I might as well ask here because it is connected. I'm planing to connect the Thing Dev to a PCA9685(https://learn.adafruit.com/16-channel-pwm-servo-driver/). I've used it with arduino already, but I'm not sure how exactly to connect it to the Thing. Considering these:
https://learn.sparkfun.com/tutorials/es ... e-overview,
https://learn.adafruit.com/16-channel-p ... er/pinouts
and
https://learn.adafruit.com/16-channel-p ... king-it-up
I can power the PCA9685 directly from the 3.3V pin of the Thing, right?

And the hook-up should be:

+3V3 -> VCC
GND -> GND
Pin 2-> SDA
Pin 14 -> SCL

Valen
Support Volunteer
Posts: 1715
Joined: Wed Dec 22, 2010 2:05 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by Valen » Wed Mar 14, 2018 8:27 am

Based on the third link the servo driver would function. But the output level of the PWM pins for the servo's is equal to Vcc. So 3.3 volt in this case. It would depend on the servo's if that is a sufficient high to drive them. I don't know what their minimal input high voltage level is.

zhulien
Posts: 11
Joined: Wed Mar 07, 2018 1:07 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by zhulien » Wed Mar 14, 2018 9:06 am

I am not driving servo motors. I am actually driving 12V LED strips through IRLB8721 MOSFETs(https://www.adafruit.com/product/355) using the PWM pins of the servo driver. Considering this:
"The threshhold voltage is also very low, less than 2.5V so you can control it directly from a microcontroller running on 2.8V, 3.3V or 5V logic." stated in the link above, I should be okay, right?

Valen
Support Volunteer
Posts: 1715
Joined: Wed Dec 22, 2010 2:05 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by Valen » Wed Mar 14, 2018 9:14 am

The minmum threshold voltage increases with the amount of current that must flow through the mosfet. Below 4 amp per mosfet it's probably ok. Look at figure 1 and 2 of the mosfet datasheet.

zhulien
Posts: 11
Joined: Wed Mar 07, 2018 1:07 am

Re: Sending data from PC to multiple Thing Devs in realtime

Post by zhulien » Wed Mar 14, 2018 9:41 am

The LED strips are 5 meters long at most. They draw about 1.2A per meter at full brightness(for the 3 channels). So, considering the worst possible case, we have 5 * 1.2A = 6A total for the whole strip. We have a MOSFET for each channel so we come up with 2A per MOSFET, so I suppose I'll be safe. Thank you so much for the input.

Post Reply