These are chat archives for Makuna/NeoPixelBus

15th
Dec 2016
marksev1
@marksev1
Dec 15 2016 11:34
btw to you sharp programmers with good eyes -> https://github.com/bruhautomation/ESP-MQTT-Digital-LEDs/blob/master/ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino does this code look like it will have problems with wifi disconnects, and mqtt broker disconnects?
3DSasha
@3DSasha
Dec 15 2016 17:30
Hello! @Makuna, I try using your bitmap file reading function but visually it is not correct. I thought that my test.bmp was wrong format and I checked your example with strings.bmp on SD. Lightshow works but not exactly as I see strings.bmp. I see colors that not present in strings (rose and violet for example) . Maybe it is my own local system bug, but other examples works fine.
joefly888
@joefly888
Dec 15 2016 18:00
Thanks Micheal for your great work. I was suggested to join by @AdySan I have been working with LightshowPi.org the LED is attached now to the Raspi. I want to now send the LED control from pi to ESp8266 for the LED part. I am new to all this so....Presently lightshowpi can strream UDP data to another pi acting as client to control through LAN. I aim to convert this to ESP attached to the LAN,
My question is (excuse me if noobie question) For streaming realtime data, is UDP sufficient for the LED attached to the ESP? Others have said that websocket is better? Given my scenerio, which do you guys recommend, for stability and realtime of endless streaming? Any advice for projects to look at ?
3DSasha
@3DSasha
Dec 15 2016 18:16
@joefly888 look http://www.vixenlights.com
joefly888
@joefly888
Dec 15 2016 18:29
@3DSasha thanks for you suggestion, but seems like it is algorithms for LED affects, this is already taken care by lightshowpi, as it reacts to sound/music, I am specifically looking at how to best communicate this output to the ESP
jakeloggins
@jakeloggins
Dec 15 2016 18:40
Better video of my project here, written tutorial to follow soon: https://www.youtube.com/watch?v=PlFHaUBc0MQ
@joefly888 why not MQTT?
@joefly888 specifically, this library: https://github.com/Imroy/pubsubclient
joefly888
@joefly888
Dec 15 2016 18:55
@jakeloggins yes, I saw your project nice work. But If I am not mistaken, MQTT are discrete data packets...not meant for streaming..think of steaming data like video and music, it has be realtime and no latency, since the lightshow is an interpretation of the music it needs to be streaming data
jakeloggins
@jakeloggins
Dec 15 2016 18:57
@joefly888 But the Pi is just sending commands to the ESP, which is in turn powering on/off the lights?
joefly888
@joefly888
Dec 15 2016 18:58
@jakeloggins but the lights are reacting realtime so the data has to come in realtime
jakeloggins
@jakeloggins
Dec 15 2016 19:10
@joefly888 MQTT is really fast. I would install the mosquitto broker on the pi directly, connect to it on the esp and just send the commands. For more: http://www.hivemq.com/blog/mqtt-essentials/
joefly888
@joefly888
Dec 15 2016 19:15
@jakeloggins your suggestion may be possible, but I hate to reinvent the wheel as there wont be many examples to follow and help with development for such specialized use. So I intend to use websockets or UDP as it is widely used for such case as mine.
jakeloggins
@jakeloggins
Dec 15 2016 19:17
@joefly888 okie doke!
joefly888
@joefly888
Dec 15 2016 19:24
@Makuna any suggestions?
Michael Miller
@Makuna
Dec 15 2016 19:25
@joefly888 (and others) Sockets uses TCPIP (which uses UDP under that), which may seem fast but it truly is much slower than UDP. TCPIP has guaranteed delivery (or error occurs) and the packets are ordered (received in the same order they are sent). Neither of these two apply to UDP. Further TCPIP is a noisy protocol and will limit the number of clients you can have on one wire (just due to bandwidth) while UDP often sees 1000 times more clients possible (and similar bandwidth increase).
Most streaming protocols use UDP and will just ignore lost packets (you may loose a uSecond of sound, but did you notice?). CoAP (a competitor to MQTT) uses UDP and implements a simple form of guaranteed packet delivery and ordering that works very well over local networks. (CoAP is preferred in industrial settings over MQTT just due to this number of nodes you can put on one wire with sensors sending often). Ever wonder why MQTT examples show updating once a minute?
SO, it can be done.
Michael Miller
@Makuna
Dec 15 2016 19:31
@3DSasha So you are loading it into memory and then bltting it or are you leaving it on the SD card? Can you simplify the code and still show the problem and send me the bits?
joefly888
@joefly888
Dec 15 2016 19:32
@Makuna so based on your comments, your suggested protocol would be in this order 1) CoAP 2)UDP 3) Websockets.....so i have been "barking up the wrong tree" going for websocket?
Michael Miller
@Makuna
Dec 15 2016 19:36
WebSockets is just HTTP form of Sockets; all over TCPIP. It will be slower than sockets alone.
joefly888
@joefly888
Dec 15 2016 19:41
@Makuna Thanks Michael, you are a big help, particularly pointing me in the right direction
Michael Miller
@Makuna
Dec 15 2016 19:42
@joefly888 Is this over a local network only?
joefly888
@joefly888
Dec 15 2016 19:43
@Makuna yes, within LAN...or alternatively is setup esp as AP and then have the dedicated Rpi as a client sending led commands to it
Michael Miller
@Makuna
Dec 15 2016 19:44
A normal sockets interface (if exposed, ESP its not sockets, its more of raw tcpip packets) will give you guaranteed and ordered packets and should be easy to switch to UDP if its too slow.
joefly888
@joefly888
Dec 15 2016 19:47
@Makuna i was led to think websockets was best by this https://www.youtube.com/watch?v=8ISbmQTbjDI how do all this fit into the picture? Sorry very new to these protocols
confusing the marco comparison among the various protocols, is what is best on ESP
Michael Miller
@Makuna
Dec 15 2016 20:18
WebSockets is a means to expose sockets across the internet. If you are not going across the internet, then normal sockets is going to be FAR better. He mentions sending a "T" in 2ms; with sockets that will be more like 0.2ms.
3DSasha
@3DSasha
Dec 15 2016 20:19
@Makuna I just used for testing your Neopixelbitmap example. I just reduced speed to see what happens. Here my test bitmap - https://www.dropbox.com/s/5bxtv844v21hvh4/test1.bmp?dl=0. I have to see led strip with colors of each bmp line (am I right?) but I see a periodic sequences of colors (4 leds period). Where is mistake...
joefly888
@joefly888
Dec 15 2016 20:21
@Makuna thanks for all this clarification, sometimes the most basic information is assumed in the most technical discussion, so this helps me a lot. I am now pursuing UDP on ESP, I assume this makes sense... after your comments...since CoAp seems not easily done on ESP
Michael Miller
@Makuna
Dec 15 2016 20:24
I have been working on a CoAP library for Arduino for a while. Before the ESP it was near impossible as the best way to implement it is with async work (thus see my Task library as a means of making it easier). Now with the ESP this is possible and I started to port my library to ESP and ran into my overall design of the library is getting in the way of doing it right, so I need to re-implement parts. Now its about finding time and priority of work I want to do ;-)
Michael Miller
@Makuna
Dec 15 2016 20:30
@3DSasha What are you seeing? Post a video?
I am assuming you changed the pixel count to the number in your strip and the file name to point to your image. With the image you have, is your strip 100 pixels?
yes, you should see each line be rendered.
joefly888
@joefly888
Dec 15 2016 20:30
@Makuna Totally understand, with your all your contribution, I can imagine the workload, looking forward to the results, in the meantime, I will work with UDP
joefly888
@joefly888
Dec 15 2016 22:34
@Makuna Got the ESP to receive UDP packets!!! WOOOOO!! But I have no idea what it is showing, can someone tell me if this is in Ascii or something??S'\xec\xe5\xe8\x11\xf2\x8a\xe1?\xc5\x15i\xc8\x9d\xde\xd7?\xdc,q\xb85!\xd2?j\xc1\x07`\x02\xee\xe8?\xb2I\x15\
(cnumpy.core.multiarray
_reconstruct
p1
(cnumpy
ndarray
p2
(I0
tS'b'
tRp3
(I1
(I14
tcnumpy
dtype
p4
(S'f8'
I0
I1
tRp5
(I3
S'<'
NNNI-1
I-1
I0
tbI00
S'0c1\x1e\xd5?\xe8?\x15P\xaaV\x05\xa4\xd4?7\x1a\xa7D\x10N\xdf?\x97\xd6\xf1\xe1\x9a\xc8\xd7?\x9a\x99\x99\x99
(I4
cnumpy.core.multiarray