Help with SparkFun Human Presence Sensor Breakout - AK9753

I'm trying to get multiple AK9753s running.

I have them all wired up and being identified with a I2C scanner sketch.

Running the example code provided by SparkFun here

Has compile errors.

Any help appreciated.

sorry I should have included this error

In function 'void setup()':
advance_config:55: error: no matching function for call to 'AK975X::begin(i2c_t3&, int, int, long int&)'
if (movementSensor.begin(Wire, I2C_SPEED_FAST, 0x64, baud) == false)

The error reads like this #include "SparkFun_AK975X_Arduino_Library.h" is not loaded.

Thanks for the reply Idahowalker

The full unedited example code from SparkFun is below. It includes the library. Just trying to compile the code produces that error.

Any other ideas?

Thanks for the help!

/*
  AK975X Human Presence and Movement Sensor Example Code
  By: Nathan Seidle
  SparkFun Electronics
  Date: March 10th, 2017
  License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

  Demonstrates how to configure advanced aspects of the sensor such as I2C address and speed,
  and different Wire streams.

  Data overrun is printed. Increase serial speed to 115200 to read fast enough.

  IR readings increase as warm bodies enter into the observable areas.

  Hardware Connections:
  Attach a Qwiic shield to your RedBoard or Uno.
  Plug two Qwiic GPS module to any port.
  Serial.print it out at 115200 baud to serial monitor.

  Available functions:
  int getIR1,2,3,4()
  void refresh() - Must be called to trigger next read
  void setMode(byte) - See defines
  void setCutoffFrequency(byte) - See defines
  bool available()
  bool overrun()
  float getTemperature()
  float getTemperatureF()
  void softReset()
*/

#include <Wire.h>

#include "SparkFun_AK975X_Arduino_Library.h" //Use Library Manager or download here: https://github.com/sparkfun/SparkFun_AK975X_Arduino_Library

AK975X movementSensor; //Hook object to the library

int ir1, ir2, ir3, ir4, temperature;

void setup()
{ 
  long baud = 115200;
  Serial.begin(baud);
  Serial.println("AK975X Read Example");

  Wire.begin();

  //Turn on sensor
  //Here we can pass it different Wire streams such as Wire1 or Wire2 used on Teensys
  //We can select FAST or STANDARD I2C speed
  //If you set the address jumpers, this is where you pass the address of the sensor you want to talk to
  if (movementSensor.begin(Wire, I2C_SPEED_FAST, 0x64, baud) == false)
  {
    Serial.println("Device not found. Check wiring.");
    while (1);
  }

  movementSensor.enableDebugging(); //Print extra debug messages if needed. Defaults to Serial.
  //movementSensor.enableDebugging(SerialUSB); //Use can pass other serial ports if desired.
  //There is also a disableDebugging();
}

void loop()
{
  if (movementSensor.available())
  {    
    ir1 = movementSensor.getIR1();
    ir2 = movementSensor.getIR2();
    ir3 = movementSensor.getIR3();
    ir4 = movementSensor.getIR4();
    float tempF = movementSensor.getTemperatureF();

    movementSensor.refresh(); //Read dummy register after new data is read

    //Note: The observable area is shown in the silkscreen.
    //If sensor 2 increases first, the human is on the left
    Serial.print("1:DWN[");
    Serial.print(ir1);
    Serial.print("]\t2:LFT[");
    Serial.print(ir2);
    Serial.print("]\t3:UP[");
    Serial.print(ir3);
    Serial.print("]\t4:RGH[");
    Serial.print(ir4);
    Serial.print("]\ttempF[");
    Serial.print(tempF);
    Serial.print("]\tmillis[");
    Serial.print(millis());
    Serial.print("]");
    Serial.println();
  }
  if(movementSensor.overrun() == true)
    {
      //At 9600bps printing takes longer than the IC can read. Increase serial to 115200bps to increase
      //read rate fast enough.
      Serial.println("Data overrun!");
    }
  delay(1);
}

dezshredder:
The full unedited example code from SparkFun is below.
It includes the library.

The sketch does not include a library.
It only includes a call to the library, which you need to install first.
Sketch>Include Library>Manage Libraries> enter "AK975" in the seach box.
Click on the AK975 box > install.
Leo..

Wawa:
The sketch does not include a library.
It only includes a call to the library, which you need to install first.
Sketch>Include Library>Manage Libraries> enter "AK975" in the seach box.
Click on the AK975 box > install.
Leo..

Thanks for the reply Leo. The library is included and I have it working on a single implementation of the AK9753 breakout board.

My issue now is running multiple sensors and I was trying to get started with SparkFun's example code, which is not working.

So one sensor is working with the Sparkfun code?

Not a good coder, but I think this sets up the different addresses.
I assume you have bridged solderbride 1 under one of the boards (address 0x65).

if (movementSensor_0.begin(Wire, I2C_SPEED_FAST, 0x64, baud) == false)
  {
    Serial.println("Device_0 not found. Check wiring.");
    while (1);
  }
if (movementSensor_1.begin(Wire, I2C_SPEED_FAST, 0x65, baud) == false)
  {
    Serial.println("Device_1 not found. Check wiring.");
    while (1);
  }

Use the same sensor names throughout the rest of the code.
Leo..

Hey Leo,

Yes, one sensor is working with a different example sketch from SparkFun. And yes, I've soldered the jumper to change the address(es).

I actually got it sorted..

Incase anyone else ends up here.

This line:

if (movementSensor.begin(Wire, I2C_SPEED_FAST, 0x64, baud) == false)

Should be:

if (movementSensor.begin(Wire, I2C_SPEED_FAST, 0x64) == false)

That allows the sketch to compile.

Thanks for the help and support

dezshredder:
sorry I should have included this error

In function 'void setup()':
advance_config:55: error: no matching function for call to 'AK975X::begin(i2c_t3&, int, int, long int&)'
if (movementSensor.begin(Wire, I2C_SPEED_FAST, 0x64, baud) == false)

Quite surely that is not the complete set of error messages you get, as you usually get a subsequent line giving a candidate function - that would have been pointing you towards the surplus parameter.

wvmarle:
Quite surely that is not the complete set of error messages you get, as you usually get a subsequent line giving a candidate function - that would have been pointing you towards the surplus parameter.

So I can further understand how to debug from these error codes, here is the full error code with the extra parameter added back.

Can you help me understand what in that would lead me to identify the extra parameter being the issue?

advance_config: In function 'void setup()':
advance_config:57: error: no matching function for call to 'AK975X::begin(TwoWire&, int, int, long int&)'
if (movementSensor.begin(Wire, I2C_SPEED_FAST, 0x64, baud) == false) //orig example code has compile error
^
In file included from /Users/dezbookpro/Documents/Arduino/PCOMP/final/prototyping/human_presence/advance_config/advance_config.ino:37:0:
/Users/dezbookpro/Documents/Arduino/libraries/SparkFun_AK975X_Human_Presence_Sensor_Library/src/SparkFun_AK975X_Arduino_Library.h:109:13: note: candidate: boolean AK975X::begin(TwoWire&, uint32_t, uint8_t)
boolean begin(TwoWire &wirePort = Wire, uint32_t i2cSpeed = I2C_SPEED_STANDARD, uint8_t i2caddr = AK975X_DEFAULT_ADDRESS);
^
/Users/dezbookpro/Documents/Arduino/libraries/SparkFun_AK975X_Human_Presence_Sensor_Library/src/SparkFun_AK975X_Arduino_Library.h:109:13: note: candidate expects 3 arguments, 4 provided
Multiple libraries were found for "Wire.h"
Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Wire
Multiple libraries were found for "SparkFun_AK975X_Arduino_Library.h"
Used: /Users/dezbookpro/Documents/Arduino/libraries/SparkFun_AK975X_Human_Presence_Sensor_Library
no matching function for call to 'AK975X::begin(TwoWire&, int, int, long int&

The error:

advance_config:57: error: no matching function for call to 'AK975X::begin(TwoWire&, int, int, long int&)'

A pointer to the error:

/Users/dezbookpro/Documents/Arduino/libraries/SparkFun_AK975X_Human_Presence_Sensor_Library/src/SparkFun_AK975X_Arduino_Library.h:109:13: note: candidate: boolean AK975X::begin(TwoWire&, uint32_t, uint8_t)
    boolean begin(TwoWire &wirePort = Wire, uint32_t i2cSpeed = I2C_SPEED_STANDARD, uint8_t i2caddr = AK975X_DEFAULT_ADDRESS);
            ^

And, for sure, an explanation for the error:

/Users/dezbookpro/Documents/Arduino/libraries/SparkFun_AK975X_Human_Presence_Sensor_Library/src/SparkFun_AK975X_Arduino_Library.h:109:13: note:   candidate expects 3 arguments, 4 provided

Thanks for breaking it down Idahowalker. That makes sense

You are welcome.

To use multiple sensors, you'd change the sensors I2C address or SPI CS pin or some other unique hardware identifier.

The you'd declare multiple objects to handle each sensor

AK975X movementSensor0; //Hook object to the library
AK975X movementSensor1; //Hook object to the library
AK975X movementSensor2; //Hook object to the library
AK975X movementSensor3; //Hook object to the library
AK975X movementSensor488; //Hook object to the library
AK975X movementSensor13679; //Hook object to the library