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

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

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

#1 Post by Ruprecht » 01 Dec 2020, 17:29

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)
Last edited by Ruprecht on 07 Dec 2020, 21:53, edited 1 time in total.

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: NeoPixelLine ??

#2 Post by kimot » 03 Dec 2020, 21:25

Do you use a level shifter for Neopixel?

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: NeoPixelLine ??

#3 Post by ThomasB » 06 Dec 2020, 18:56

... 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

Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

Re: NeoPixelLine ??

#4 Post by Ruprecht » 07 Dec 2020, 21:31

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

Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

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

#5 Post by Ruprecht » 13 Dec 2020, 16:47

Done :)

Image

All you need to build this is here: https://www.dropbox.com/sh/n78ujjxalloj ... mOb0a?dl=0
Last edited by Ruprecht on 19 Dec 2020, 15:48, edited 1 time in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

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

#6 Post by TD-er » 13 Dec 2020, 19:26

Cool :)

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests