Page 1 of 1

CO2-measurement with MH-Z19b / Neopixel / 7 segment display

Posted: 01 Dec 2020, 17:29
by Ruprecht
I am currently trying to build a CO2 display with a neopixel ring. However, the display does not work so far because I can only find insufficient information about the NeoPixelLine command:
viewtopic.php?t=7991&p=47186

NeoPixelLine 1,4,0,255,0
the first 4 pixels should light up green, but only the first Pixel light up

(ESP_Easy_mega_20201130_normal_ESP8266_4M1M)

Re: NeoPixelLine ??

Posted: 03 Dec 2020, 21:25
by kimot
Do you use a level shifter for Neopixel?

Re: NeoPixelLine ??

Posted: 06 Dec 2020, 18:56
by ThomasB
... so far because I can only find insufficient information about the NeoPixelLine command
FWIW, the command usage is shown in the P038_NeoPixel Plugin's source. See snippet excerpt below.

Code: Select all

// List of commands:
// (1) NeoPixel,<led nr>,<red 0-255>,<green 0-255>,<blue 0-255>
// (2) NeoPixelAll,<red 0-255>,<green 0-255>,<blue 0-255>
// (3) NeoPixelLine,<start led nr>,<stop led nr>,<red 0-255>,<green 0-255>,<blue 0-255>

// Usage:
// (1): Set RGB Color to specified LED number (eg. NeoPixel,5,255,255,255)
// (2): Set all LED to specified color (eg. NeoPixelAll,255,255,255)
//		If you use 'NeoPixelAll' this will off all LED (like NeoPixelAll,0,0,0)
// (3): Set color LED between <start led nr> and <stop led nr> to specified color (eg. NeoPixelLine,1,6,255,255,255)

//RGBW note:
// for RGBW strips append the additional <brightness> to the commands
// eg: NeoPixel,<led nr>,<red 0-255>,<green 0-255>,<blue 0-255>,<brightness 0-255>
// The NeoPixelLine command does not work for RGBW, cause espeasy currently only allows max. 5 parameters

//Added HSV compatibility for Homie convention and others
// Hue, Satuation and Value (Intensity/Brightness) is a more human readable and easier to adjust color space with only 3 values
// can therfor be used for RGBW LEDs too without limitations mentioned above.
// expects Hue from 0-360° and satuation and value form 0-100% so can be used with integers too.
// Used functions HUE2RGB & HUE2RGBW can handle float and are precice but not optimized for speed!
If you are using a RGBW type neopixel then be sure to observe the usage limitations mentioned in the command summary.

- Thomas

Re: NeoPixelLine ??

Posted: 07 Dec 2020, 21:31
by Ruprecht
Thank you for your many hints. It was actually my own fault. LED count was at 1 :oops:
A level converter was not necessary as long as I didn't put a resistor in the signal line to the Neopixel ring. Now everything works and all only needs a home.

If someone is also interested in CO2 measurement, here are my photos and informations:

Image


Image

Code: Select all

on CO2MHZ#PPM do
  SendToHTTP 192.168.178.19,8080,/json.htm?param=udevice&type=command&idx=1392&nvalue=[CO2MHZ#PPM]
  7dn,[CO2MHZ#PPM]
  TaskValueSet 3,1,(([CO2MHZ#PPM]/100)-3)
  TaskValueSet 3,2,([Speicher#Num]-2)
  NeopixelLine,[Speicher#Num1],24,0,0,0
  if [CO2MHZ#PPM]>1501
    NeoPixelLine,1,[Speicher#Num],3,0,1  // LEDs pink
 Elseif [CO2MHZ#PPM]>1201
    NeoPixelLine,1,[Speicher#Num],3,0,0  // LEDs red
 Elseif [CO2MHZ#PPM]>901
    NeoPixelLine,1,[Speicher#Num],4,1,0  // LEDs orange
 Elseif [CO2MHZ#PPM]>701
    NeoPixelLine,1,[Speicher#Num],3,2,0  // LEDs yellow
  Else
    NeoPixelLine,1,[Speicher#Num],0,3,0  // LEDs green
  Endif
endon

Re: CO2-measurement with MH-Z19b / Neopixel / 7 segment display

Posted: 13 Dec 2020, 16:47
by Ruprecht
Done :)

Image

All you need to build this is here: https://www.dropbox.com/sh/n78ujjxalloj ... mOb0a?dl=0

Re: CO2-measurement with MH-Z19b / Neopixel / 7 segment display

Posted: 13 Dec 2020, 19:26
by TD-er
Cool :)