Giter Club home page Giter Club logo

arduino-i2c-sen5x's Introduction

Sensirion I2C SEN5X Arduino Library

This is the Sensirion SEN5X library for Arduino using the modules I2C interface.

Supported sensors

  • SEN50 (only particulate matter signals available)
  • SEN54 (no NOx signal available)
  • SEN55 (full feature set)

Installation

To install, download the latest release as .zip file and add it to your Arduino IDE via

Sketch => Include Library => Add .ZIP Library...

Don't forget to install the dependencies listed below the same way via Add .ZIP Library

Note: Installation via the Arduino Library Manager is coming soon.

Dependencies

Quick Start

  1. Connect the SEN5X Sensor to your Arduino board's standard I2C bus. Check the pinout of your Arduino board to find the correct pins. The pinout of the SEN5X Sensor board can be found in the data sheet.

    SEN5X Arduino Jumper Wire
    VCC 5V Red
    GND GND Black
    SDA SDA Green
    SCL SCL Yellow
    SEL GND for I2C Blue
    Pin Name Description Comments
    1 VCC Supply Voltage 5V ±10%
    2 GND Ground
    3 SDA I2C: Serial data input / output TTL 5V and LVTTL 3.3V compatible
    4 SCL I2C: Serial clock input TTL 5V and LVTTL 3.3V compatible
    5 SEL Interface select Pull to GND to select I2C
    6 NC Do not connect
  2. Open the exampleUsage sample project within the Arduino IDE

     File => Examples => Sensirion I2C SEN5X => exampleUsage
    
  3. Click the Upload button in the Arduino IDE or

     Sketch => Upload
    
  4. When the upload process has finished, open the Serial Monitor or Serial Plotter via the Tools menu to observe the measurement values. Note that the Baud Rate in the corresponding window has to be set to 115200 baud.

Contributing

Contributions are welcome!

We develop and test this driver using our company internal tools (version control, continuous integration, code review etc.) and automatically synchronize the master branch with GitHub. But this doesn't mean that we don't respond to issues or don't accept pull requests on GitHub. In fact, you're very welcome to open issues or create pull requests :)

This Sensirion library uses clang-format to standardize the formatting of all our .cpp and .h files. Make sure your contributions are formatted accordingly:

The -i flag will apply the format changes to the files listed.

clang-format -i src/*.cpp src/*.h

Note that differences from this formatting will result in a failed build until they are fixed.

License

See LICENSE.

arduino-i2c-sen5x's People

Contributors

leoniefierz avatar mbjoern avatar psachs avatar qfisch avatar rol-la avatar sdmueller avatar sensirion-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-i2c-sen5x's Issues

Not enough space in buffer

Hello, I am an Application Engineer in Seeed Studio.
I used the code from exampleUsage.
image
I have this problem in Arduino Uno.
Not enough space in buffer.
I made a usage list.

Board Not enough space
Arduino Uno Yes
Genuino Uno Yes
Genuino 101 Yes
Arduino Mega 2560 Yes
Arduino Due Yes
Wio Terminal(Atmel SAMD51) Yes
ESP32 No

NOx set state

Hi,

I'm just wrapping my head around how setVocTuningParameters and setVocAlgorithmState work and differ.

Does the algorithm state store historical data such as 12hour history, and so it differs from just storing setting parameters for VocTuningParameters - such as offsets?

Is there a reason there is a setNoxTuningParameters but no setNoxAlgoirthmState, whilst VOC has this? I'm looking at the SGP41 repo, and it seems this can exist and can be made available? I'm trying to understand if this is possible on the SEN51. Is there more documentation on this?

Thanks!!

Sen55 auto-cleaning

Error
Hello, I am new to working with the Sensirion devices and am unsure if this is the right place to ask but I currently have a Sen55 connected to an ESP32 Dev Kit and I am trying to change the auto clean of the fan by using the sen5x.setFanAutoCleaning() function. Everything compiles fine but when I upload the code I get some kind of guru error. Its not the biggest issue since I know the fan is automatically set to auto clean every week but as someone new to this I am just curious what could be causing this. I even tried to use sen5x.StartFanCleaning(); to force it to clean but I get the same error. Thank you for your help!

Code documentation inconsistent with PDF - startMeasurementWithoutPm()

The code documentation for startMeasurementWithoutPm() states:

 * This command is only available in idle mode. If the device is already
 * in any measure mode, this command has no effect.

The application note "Reduced Power Operation for SEN5x - Application note describing SEN5x reduced power mode" v1.0 shows a state diagram with transitions DIRECTLY between the gas-only and PM-inclusive modes.

Could you please advise which is correct (and fix the incorrect!)

I2C 3.3v

I'd like to use the SEN55 with a 3.3v microcontroller. I see that the I2C interface supports 3.3v but I'm wondering if/how to explicitly set it. I want to make sure the sensor doesn't send 5v to my controller. Can you please help explain?

Thanks.

(sorry for posting a question and not an actual issue. Is there a better place to post than here?)

Not getting raw voc value using readMeasuredRawValues() function

Getting 65535 repeatedly as raw value, while I am getting voc index value. But I actually need voc raw value in ppb. Please help.
not able to understand what is voc value in ticks. ticks in my knowledge is timing/ clock cycle of mcu. how can we relate this to a physical value like temperature, voc, etc?

Curiosities - Could SEN50 be made to return temp/humidity in all methods that return them?

Hey, I've got all three models, and using the measureValues as floats works nicely for the 55+54, but the 50 returns failed temp+humidity values (NAN) and valid particle counts (and expected NANs for nox/voc).
I do know that there's a separate method for the sen50, but could the other method be made to not fail, as that would make most peoples lives easier. Don't drop the method for the 50, but make the other methods work as far as possible for the 50.
Thanks ❤️

Also on the curiosities front, I just got 3 new (one of each) sensors, and previously just had a single SEN55 from the same supplier. I've found the new lot to be vibrating more than expected (fan vibrations). Particularly when held by both sides between thumb and forefinger, from next to cable to edge of QRcode. Is this expected to be quite a lot, and how would one even measure such a thing?
Is there a batch number or anything in the QRcode that tells me which fan I've got if you've used more than one?

Incorrect 'typicalParticleSize' returned from 'readMeasuredPmValues'

The header file for the library notes that 'typicalParticleSize' as returned by 'readMeasuredPmValuesAsIntegers' needs to be scaled, by dividing by 1000, to produce the floating point size in microns as returned by 'readMeasuredPmValues'. The code only divides by 10. Boulders!

setVocAlgorithmState Example

I am trying to get the voc algorithm state and set it upon startup.

For getting the algorithm array

byte statesize = 12;
byte state[statesize];
int error = sen5x.getVocAlgorithmState(state,statesize);

Output : { 49, 229, 238, 62, 0, 49, 202, 99, 185, 252, 63, 123 }

After that when saving the state, "Not enough space in buffer" error triggers for the following code:

byte statesize = 12;
byte state[statesize] = { 49, 229, 238, 62, 0, 49, 202, 99, 185, 252, 63, 123 };
char errorMessage[256];
int error = sen5x.setVocAlgorithmState(state,statesize);
if(error)
{
    errorToString(error, errorMessage, 256);
    Serial.println(errorMessage);
}

The error occurs from the Sensirion Arduino Core --> SensirionI2CTxFrame.cpp --> uint16_t SensirionI2CTxFrame::_addByte(uint8_t data) function.

SEN5x datasheet says in section 6.1.11 that there is Checksum returned when reading. Do I not send the checksum when using the setVocAlgorithmState ? An example of how to set the state would be really appreciated. Thank you

same valu of PM10 PM2.5 PM4

Hello,
I'm using a SEN54 and SEN55 with an ESP32 C3 board in deep sleep mode. I run the code and I let SEN54 run for 20 seconds before stop measuring and enter the board into sleep. I left the board running for days but I always get the same value of PM10 PM2.5 PM4, it's pretty weired.

what I'm missing? I used the code example available in this rep.

best

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.