Human Presence Sensor Breakout - AK9753

@bpr @peekay123 @ScruffR

Sparkfun started selling these 4 channel low current IR 100uA human presence detector chips.

I picked one up for testing, still looking for that perfect always ON, Low Power, reliable security sensor :slight_smile:

Interested in how well it can track customers in and out of any business like this:

4 Likes

Thank you for sharing this!

1 Like

Has anyone had success using this breakout board, and the Sparkfun-created library for it, on the Photon? I’ve used it in the past on the Photon, but now that I’m trying a new project I’m getting familiar errors and can’t remember (or find any notes) on how I got it work in the past.

I’m including the SparkFun_AK9750_Arduino_Library.h library and getting the error:

“WProgram.h: No such file or directory”

Any ideas on how to resolve this?

Thanks in advance.

Based on another post I replaced:

#include WProgram.h

with

#include Particle.h

in the SparkFun_AK9750_Arduino_Library.h file.

This resolved the No such file or directory error for WProgram.h but then I got the same error for Wire.h, which I then commented out since I’ve read that it’s included elsewhere.

Now I’m getting a whole slew of errors such as:
32

It’s killing me because I know I’ve gotten this to work in the past!

I got it working, I’ll dig up the code once I get back to my laptop.

WIth some fairly new Device OS version you should be able to also add #include "Arduino.h" which will set the ARDUINO version value in a way that the TwoWire (aka Wire or I2C) functions should be compatible.

WProgram.h is even outdated on the Arduino side and was replaced with Arduino.h (years ago) - hence this standard block in many Arduino libraries

#if (ARDUINO >= 100)
#include "Arduino.h"  // <-- new versions
#else
#include "WProgram.h" // <-- ancient versions
#endif

For your errors, setClock() is called setSpeed() nowadays.

And this block is syntactically wrong in the library

  if bitRead(currentSettings,0) return 5;
  if bitRead(currentSettings,1) return 1;
  if bitRead(currentSettings,2) return 2;
  if bitRead(currentSettings,3) return 3;
  if bitRead(currentSettings,4) return 4;

if statements compulsory require the condition to be wrapped in parenthesis hence it should rather be

  if ( bitRead(currentSettings,0) ) return 5;
  if ( bitRead(currentSettings,1) ) return 1;
  if ( bitRead(currentSettings,2) ) return 2;
  if ( bitRead(currentSettings,3) ) return 3;
  if ( bitRead(currentSettings,4) ) return 4;

Maybe the Arduino compiler is less picky, but that would mean not obeying the C/C++ syntax, which should be considered bad practice.

So for the latter errors, the error message: “expected '(' before 'bitRead'”, was perfectly clear about what’s wrong and how to solve it IMO.

Thanks @ScruffR. Yes, the last error was pretty obvious - I was fixated on the former error.

I was able to get it to compile by making these changes, but first I had to add some #defines to the library .h file because I was getting errors stating that bitRead was not defined. I got the answer for that error from the following post:

Adding those defines allowed the code to compile. Now I just have to see if it works.

Thanks much.

You really need the custom plastic lenses to go over the sensor for decent performance from this chip from my testing. Problem is that the company that makes the chip does not have any of their new lenses for this sensor and can’t tell me when they will be available or how much the they will cost in low quantities.

I ended up using the Panasonic Eye Grid sensor that does not need a lenses and provides a 8x8 grid of readings vs the 4 points of this sensor.

1 Like