I’m using the Qwiic PIR - 170uA (EKMC4607112K).
I’ve searched your web site for a description and addresses of the I2C registers but can find any information.
Can anyone provide the I2C register addresses and a description of there uses?
I’m using the Qwiic PIR - 170uA (EKMC4607112K).
I’ve searched your web site for a description and addresses of the I2C registers but can find any information.
Can anyone provide the I2C register addresses and a description of there uses?
I think you might be looking for this https://github.com/sparkfun/SparkFun_Qw … egisters.h ?
If you are referring to this then I’m still confused by the cryptic names SparkFun gave them:
//Register Pointer Map
enum Qwiic_PIR_Register : uint8_t
{
ID = 0x00,
FIRMWARE_MINOR = 0x01,
FIRMWARE_MAJOR = 0x02,
EVENT_STATUS = 0x03,
INTERRUPT_CONFIG = 0x04,
PIR_DEBOUNCE_TIME = 0x05,
DETECTED_QUEUE_STATUS = 0x07,
DETECTED_QUEUE_FRONT = 0x08,
DETECTED_QUEUE_BACK = 0x0C,
REMOVED_QUEUE_STATUS = 0x10,
REMOVED_QUEUE_FRONT = 0x11,
REMOVED_QUEUE_BACK = 0x15,
I2C_ADDRESS = 0x19
};
What does DETECTED_QUEUE_STATUS, DETECTED_QUEUE_FRONT, DETECTED_QUEUE_BACK, REMOVED_QUEUE_STATUS , REMOVED_QUEUE_FRONT, and REMOVED_QUEUE_BACK mean?
In the Hookup Guide it says:
“The Qwiic versions of these PIR breakouts feature an ATTiny84 with firmware that handles monitoring the sensor’s output signal, debouncing that signal along with a configurable interrupt and translates it all to the I2C interface; making it easy to add a PIR to an existing Qwiic/I2C project.”
So which registers are the PIR output signal and Interrupt? There is an INTERRUPT_CONFIG = 0x04 but what number do I put in to configure the Interrupt? Which bit in each register does what. Are any 16 bit and if so which byte is the MSB?
Where it says PIR_DEBOUNCE_TIME = 0x05. Does the 0x05 mean the value 0x05 is INthe PIR_DEBOUNCE_TIME register or PIR_DEBOUNCE_TIME ISregister 5?
Looks to me that those are register numbers, so PIR_DEBOUNCE_TIME is register #5
Does SparkFun Tech Support have answers to my above questions?
Looking at registers.h,
the status register (0x03) has the following bits defined:
bool rawReading : 1; // This is bit 0. This is the raw reading from the PIR, it is not user writable
bool eventAvailable : 1; //User mutable, gets set to 1 when a new event occurs. User is expected to write 0 to clear the flag.
bool objectRemoved: 1; //Defaults to zero on POR. Gets set to one when the PIR reports an object removal. Must be cleared by the user.
bool objectDetected : 1; //Defaults to zero on POR. Gets set to one if the PIR detects an objects.
The interrupt register (0x04) has one bit defined:
bool interruptEnable : 1; //This is bit 0. User mutable, set to 1 to enable an interrupt when the PIR detects an object.
Queue status registers (0x07 and 0x10) have the following bits defined:
bool popRequest : 1; //This is bit 0. User mutable, user sets to 1 to pop from queue, we pop from queue and set the bit back to zero.
bool isEmpty : 1; //user immutable, returns 1 or 0 depending on whether or not the queue is empty
bool isFull : 1; //user immutable, returns 1 or 0 depending on whether or not the queue is full
From SparkFun_Qwiic_PIR.h, the default I2C address is 0x12 and the default ID is 0x72. It looks like this code is based on the QWIIC switch/button board code. For that one, device ID is used to differentiate between the switch and button boards, but for this one, there is only one ID.
QUEUE_FRONT looks like the time since the last detection and QUEUE_BANK is the time since the first detect. These appear to be 4-registers long (ie. are 32 bit values)
unsigned long timeSinceLastDetect(); //Returns how many milliseconds it has been since the last object detection. Since this returns a 32-bit unsigned int, it will roll over about every 50 days.
unsigned long timeSinceFirstDetect(); //Returns how many milliseconds it has been since the first object detection. Since this returns a 32-bit unsigned int, it will roll over about every 50 days.
If you are using an Arduino to talk to the PIR sensor, it is better to use the public functions in SparkFun_Qwiic_PIR.h, rather than messing at the register level.
Look in https://github.com/sparkfun/SparkFun_Qw … r/examples for examples of how to use this library
/mike
Thanks!