Skip to content

How do I turn on the LEDs? #4

Closed

Description

@dave-hillier

There are two LEDs mounted on the front of the PCB. I'm guessing that they're connected to Pin 20 from the Pixart datasheet. I didn't see any other mention.

How do I access them? Do I write to a register?

Activity

  1. Gadgetoid commented on Nov 28, 2019

    @Gadgetoid
    Member

    As far as I'm aware, the LEDs are entirely under the control of the flow sensor. Looking over the datasheet doesn't seem to indicate otherwise.

  2. dave-hillier commented on Nov 28, 2019

    @dave-hillier
    Author

    https://datasheetspdf.com/pdf-file/1309999/PixArt/PMW3901MB-TXQT/1

    Screenshot 2019-11-28 at 22 48 16

    Screenshot 2019-11-28 at 22 49 36

    There is no appendix B 🤷‍♂️

    Any ideas? not sure how they're even connected to the chip - that is actually an input

  3. Gadgetoid commented on Dec 18, 2019

    @Gadgetoid
    Member

    Looks like it's an open-drain pin capable of sinking the current requirements of the LEDs- our schematics show the LEDs connected to 3.3v via a 150R current-limiting resistor and then directly to the LED_N pin in parallel.

  4. DigitalSamU commented on Feb 24, 2020

    @DigitalSamU

    I've been using this sensor with an Arduino. To get the LEDs to turn on I needed to add the following to the initRegisters routine in the PMW2901 library:
    delay(200);
    registerWrite(0x7f, 0x14);
    registerWrite(0x6f, 0x1c);
    registerWrite(0x7f, 0x00);

    you may need to do something similar in the python library

  5. dave-hillier commented on Feb 24, 2020

    @dave-hillier
    Author
  6. Gadgetoid commented on Feb 25, 2020

    @Gadgetoid
    Member

    I should probably mirror this functionality in the Python library. Does the above work to give the user manual control over the PMW3901 LEDs @dave-hillier?

  7. dave-hillier commented on Feb 25, 2020

    @dave-hillier
    Author

    I havent had chance to test it sorry! I parked my project after a recent house move

  8. DigitalSamU commented on Feb 25, 2020

    @DigitalSamU

    I should probably mirror this functionality in the Python library. Does the above work to give the user manual control over the PMW3901 LEDs @dave-hillier?

    No, but I was thinking of creating a separate routine that set them on/off in the library, rather than including it in the initRegisters routine. Unfortunately the registers are kept secret by the manufacturer so it's very much trial and error.

  9. Gadgetoid commented on Mar 16, 2020

    @Gadgetoid
    Member

    Unfortunately the registers are kept secret by the manufacturer so it's very much trial and error.

    You're not wrong, the amount of cloak and dagger "write these values to these registers we wont tell you what they are/mean" with this chip is absurd.

    For example, enabling Raw Frame Grab mode (mentioned here #5) takes about 11 successive, minimally documented register writes. And that's to say nothing of the init sequence.

  10. MartinSpengler commented on Nov 2, 2020

    @MartinSpengler

    I had a special scenario where I just wanted to measure short bursts then pause thus the LED does not have to be on all the time. I added this function to Bitcraze_PMW3901.cpp

    void Bitcraze_PMW3901::setLed(bool state)
    {
      if(state){
        // trying to switch on the LED
        delay(200);
        registerWrite(0x7f, 0x14);
        registerWrite(0x6f, 0x1c); // DEC 28
        registerWrite(0x7f, 0x00);
      }else{
        // trying to switch off the LED
        delay(200);
        registerWrite(0x7f, 0x14);
        registerWrite(0x6f, 0x00); 
        registerWrite(0x7f, 0x00);
      }
    }
    

    What a pity that there seems to be no details about all the registers available. I have the feeling that this chip has a lot more features like Low Light mode.

  11. Gadgetoid commented on Nov 2, 2020

    @Gadgetoid
    Member

    @MartinSpengler does the "switch off" command return control of the LED to the PMW3901 for normal operation, or does it disable/turn off the LED completely?

    The state of the datasheet for this part makes me outright angry, I can't fathom what dark secret they're trying to protect by being so obtuse but they're basically sticking a big "HA! No, you don't get to play in our garden" sign right at the big end to their customer conversion funnel.

  12. MartinSpengler commented on Nov 2, 2020

    @MartinSpengler

    @Gadgetoid I had to reverse engineer this in a way. Only thing I know is the LED are off after calling registerWrite(0x6f, 0x00);.
    Do you think there is a mode where PMW3901 controls the LED by itself, like switching it on in low light conditions or so?
    Given the fact that switching it on is done by sending a DEC 28 its possible that the brightness could also be controlled.

  13. dave-hillier commented on Oct 8, 2021

    @dave-hillier
    Author

    Closing since my PR was merged and solved my problem. There's been no further comment

  14. bablokb commented on Dec 3, 2024

    @bablokb

    See https://forums.pimoroni.com/t/control-white-leds-on-paa5100je/26694/3

    That post has working code for a set_illumination() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions