Best way to handle Serial data from a PC?

Posted on
  • I have a bunch of data that I want to be transferred from my PC to the Espruino then to a display. Would it be better to have a script on the Espruino parse the JSON Data and write it to the display, or would it be better for the PC to send direct graphics drawString's then flip it at the end?

    I was thinking the latter as it would mean the Espruino doesn't need to be written then saved, the PC can just write the init code for the display when it connects.

  • It all depends... is the techno-political correct - and therefore often very frustrating - answer...

    But good middle ground can be found case by case: If there is a lot of processing to do and you have decent communication band width, you may process all in your (PC) power house and stream the final pixel graphic to Espruino - just as you have to do with pictures.

    If bandwidth is a challenge but you have a strong display controller that can render nicely - for example with built in fonts - sending the data as terse as possible to Espruino is the answer.

    I do not know what your constraints and options are in regard of how Espruino communications with your display - serial or parallel (4..16 bit) - and who does transform the data into pixels - assuming it is some kind of text.. I know from own experience in several 'projects' quite a while ago, that Espruino may still be pretty fast in processing and creating the pixelation, but the connectivity to the display is / feels slow - even though it is 1MBit/sec - due to being serial: PacMan is still hibernating... Display data sent from GPS every second required some optimization (update display only for changed parts and update only parts).. Touch screen calibration posed not only a (time) performance challenge, but also a memory challenge: Saving 20x20 pixels eats up 800..1200 Bytes, not to talk about an overlay pop-up that requires larger areas to save and restore (because a re-rendering the whole screen is practically impossible for multiple reasons). Two additional applications besides the GSP data display made it to work half way decent by dedicated design: UI with buttons and check boxes and a number puzzle on touch screen.

    Lately, I see more large dotted bi and tri color LED panels used, an I guess that's where your project is headed as well. For some of the applied technologies, each pixel requires 4 bytes... even worse than the LCD controller I had, and the speed for updating is 400kHz vs 1+MHz... I was 'thinking' of making a LED cube with Espruino... but from what I see what hoops other implementations have to jump through, it did not become more appealing.

    As a neat note: around Christmas I toured some of the 'crazy' and really amazing Lights of the Valley shows. The one on 1683 Catalonia Way took my breath away from the engineering and resources points of view: a quad core calculating a given picture and send it out to 64 strands with 50 lights each (interlaced: 128 x 25). The one time 'folded' strands shaped a three stories tall Christmas tree from bottom to top band back to bottom in form of a cone, like a cone shaped LED display 'panel'. Each light is directly addressable by 64 multi drop lines or busses or physical networks. And while watching, the creators were creating - digitalizing - new pictures that got transformed, transferred - and running instantly. Enjoy the clips on youtube!


    1 Attachment

    • Megatree.png
  • I'm not sure - I guess it depends how much flexibility you want on the PC. For instance if you want to be able to draw bitmaps you might as well just draw one big bitmap which is the screen.

    You don't have to use JSON though - you could just send the data as binary. Only issue then is 'framing' so you know when the start of the data is, but you could do that by just having a timeout.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Best way to handle Serial data from a PC?

Posted by Avatar for MrTimcakes @MrTimcakes

Actions