Applying CSV data to NeoPixels directly

Hello,

I am working on a project which will translate sleep data in CSV format into different sections of light on a NeoPixel strip.

It’s a very large data set (over 800MB), and currently I have a bit of Python code which is going through the data and I can access different values per row:

import pandas as pd
import time

filename = "/Users/lauramadeley/Desktop/Sleep_Study/Traces_filtered_data.csv"

for row in pd.read_csv(filename, chunksize=1):
    print(float(row['4'].values))
    time.sleep(2)

I was hoping at first to do something simple, like split the NeoPixel Strip into 12 sections (for the 12 columns of data) change the brightness of each section according to the data.

What is the best approach here? It’s hard for me to understand how approach this using the concept of an ‘animation’. Is there any best approach that comes to mind here?

Thank you,

Laura

Laura,

A few questions for context:

  • With what hardware are you controlling the NeoPixels? Is it one of our products such as the AllPixel or PiPixel?

  • What does the data look like? Translating it to pixels is entirely dependent on what form the data is in already.

Don’t get turned away by the term “animation” here… it’s just a convenience wrapper. An animation is simply:

  • An initial setup() function that runs once

  • A step() function that is called once for every frame

If you were going to display data and not use the animation concept you’d just have a while loop most likely, grab some data, display it, and return to the top of that loop. That loop is the step() function. It’s just that BiblioPixel handles the looping and frame rate (and a bunch of other things) for you.

So, let’s say that your data is such that each row represents 100ms of data. In step() you would read the next line, translate that to pixels however you want/need, and then run that animation at 10 frames per second to match the CSV “data rate”.

Once I get answers to the initial questions I can be more specific.

Hope that helps.

Cheers,

Adam

···

On Thu, Feb 28, 2019 at 7:09 AM Laura M drlauramadeley@gmail.com wrote:

Hello,

I am working on a project which will translate sleep data in CSV format into different sections of light on a NeoPixel strip.

It’s a very large data set (over 800MB), and currently I have a bit of Python code which is going through the data and I can access different values per row:

import pandas as pd
import time

filename = "/Users/lauramadeley/Desktop/Sleep_Study/Traces_filtered_data.csv"

for row in pd.read_csv(filename, chunksize=1):
    print(float(row['4'].values))
    time.sleep(2)

I was hoping at first to do something simple, like split the NeoPixel Strip into 12 sections (for the 12 columns of data) change the brightness of each section according to the data.

What is the best approach here? It’s hard for me to understand how approach this using the concept of an ‘animation’. Is there any best approach that comes to mind here?

Thank you,

Laura

You received this message because you are subscribed to the Google Groups “Maniacal Labs Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to maniacal-labs-users+unsubscribe@googlegroups.com.

To post to this group, send email to maniacal-labs-users@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/maniacal-labs-users/89f5c113-4e8c-4532-b4be-842364d6c43f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hello Adam,

Thank you or getting back and sorry for the delay in response, just getting back this project.

In answer to your questions:

Yes, I am using an All Pixel mini to control the Neopixels.

At the moment the data is in CSV format - 12 columns of data, with 65535 data points - it’s sleep biodata.

The Python code I posted just loads them in row by row and displays the data columns in that row.

What I am hoping to do iterate through these rows of data one by one over a period of time, and apply the 12 data features, to different aspects of the LED strip - at the moment I would like to experiment with how that might actually happen, but for example just mapping the 12 columns of data to the brightness of 12 different sections of a single LED strip might be a good place to start.

Thanks again for any advice you have!

Laura

···

On Thursday, 28 February 2019 12:18:15 UTC, Adam Haile wrote:

Laura,

A few questions for context:

  • With what hardware are you controlling the NeoPixels? Is it one of our products such as the AllPixel or PiPixel?
  • What does the data look like? Translating it to pixels is entirely dependent on what form the data is in already.

Don’t get turned away by the term “animation” here… it’s just a convenience wrapper. An animation is simply:

  • An initial setup() function that runs once
  • A step() function that is called once for every frame

If you were going to display data and not use the animation concept you’d just have a while loop most likely, grab some data, display it, and return to the top of that loop. That loop is the step() function. It’s just that BiblioPixel handles the looping and frame rate (and a bunch of other things) for you.

So, let’s say that your data is such that each row represents 100ms of data. In step() you would read the next line, translate that to pixels however you want/need, and then run that animation at 10 frames per second to match the CSV “data rate”.

Once I get answers to the initial questions I can be more specific.

Hope that helps.

Cheers,

Adam

On Thu, Feb 28, 2019 at 7:09 AM Laura M drlaura...@gmail.com wrote:

Hello,

I am working on a project which will translate sleep data in CSV format into different sections of light on a NeoPixel strip.

It’s a very large data set (over 800MB), and currently I have a bit of Python code which is going through the data and I can access different values per row:

import pandas as pd
import time

filename = "/Users/lauramadeley/Desktop/Sleep_Study/Traces_filtered_data.csv"

for row in pd.read_csv(filename, chunksize=1):
    print(float(row['4'].values))
    time.sleep(2)

I was hoping at first to do something simple, like split the NeoPixel Strip into 12 sections (for the 12 columns of data) change the brightness of each section according to the data.

What is the best approach here? It’s hard for me to understand how approach this using the concept of an ‘animation’. Is there any best approach that comes to mind here?

Thank you,

Laura

You received this message because you are subscribed to the Google Groups “Maniacal Labs Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to maniacal-labs-users+unsubscribe@googlegroups.com.

To post to this group, send email to maniacal-...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/maniacal-labs-users/89f5c113-4e8c-4532-b4be-842364d6c43f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.