element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experimenting with Gesture Sensors
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Gesture Sensors
  • More
  • Cancel
Experimenting with Gesture Sensors
Challenge Blog Blog #15: Experimenting with Two MAX25405 Kits
  • Challenge Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experimenting with Gesture Sensors to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: misaz
  • Date Created: 3 Jan 2023 1:52 PM Date Created
  • Views 965 views
  • Likes 8 likes
  • Comments 4 comments
  • MAX25405
  • experimenting with gesture sensors
  • MAX25405EVKIT
Related
Recommended

Blog #15: Experimenting with Two MAX25405 Kits

misaz
misaz
3 Jan 2023

Hello everyone. I welcome you to my one to last blog post as part of Experimenting with Gesture Sensors. In previous blog post I shown my final project. Today I will show one of my experiments which I have done as part of experimenting with the sensor. Today I will show how two MAX25405 sensor works.

If you remember my blog Blog #8: 12V Accident, I burned my kit, ordered new kit, but later I decided to fix broken kit, so now I have two kits (fixed burned kit and new kit). This allows me to try sensor synchronization features of the MAX25405 sensor when using two sensors at the same time. The issue is that when using two sensors, their infra-red LEDs interfere with LEDs form other kit.

Improving stand for allowing using two sensors

For my initial experiments with this setup, I upgraded my stand which I originally developed for using with single sensor and described in previous Blog #4: Building stand for MAX25405 EVKIT. Now it allows me to mount two sensors very near each other. Stands from, building set is much more flexible than plastic 3D printer stands as you can see. This is not practical setup for using two sensors. It does not make sense to place two sensors in the very similar position. Instead with two sensor practical use case is to set sensors at different positions allowing them sensing gestures from two points of view which can later allow more precise and accurate gesture detection. But this setup was done mainly for experimenting with sensor and allows me for example compare sensor outputs as you will see later.

Connecting Two Sensors

MAX25405 allows two interface and in both cases, it allows running two sensors by the same master. In case of I2C bus it is achieved by two I2C addresses and in case of SPI it can be achieved by using two chip select ports. In my experiments I used SPI bus, so I was driving and selecting sensor by CS pins. My library has support for this feature for both buses. As a microcontroller I used MAX78000 on FTHR board the same as in previous project. For an application I configured sensor, implemented support for receiving interrupt from both sensors and after they interrupted I read new screen data. These I printed over UART. For visualization I used WebSerial API. I edited it to support output format from my MCU application and also added second table for visualizing data from second sensor.

Running Two Sensor Unsynced

At beginning I tried running it simple without any synchronization. Just two sensors running totally independently. Result you can see on the following video:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

I recommend opening this video on youtube and playing it slowed down.

As you can see there is very high noise. If you pause video, you can see that when I was holding hand in fixed position at highest value pixel, I have seen values flickering between values. For example, in one moment there were value of 1788 and soon later the same pixel returned 3719. It is very big difference!

But as you can see generally object is visible even it is flickering. With proper filter I think it is possible to detect gestures, but it of course always affects detection reliability significantly.

Methods of Syncing Sensors

MAX25405 allows two methods of syncing two sensors. Idea of syncing is that Sensor enables IR led if and only if other sensor is sleeping and do not sample sensor data. MAX25405 allows configuring time when the sensor is active and when it is inactive. The two methods of synchronization are following:

  • Manually by registry writes and single shoot mode.
  • Automatically by SYNC pin. One sensor is master, second is slave.

The first mentioned method is trivial. You write firmware in a way that it triggers conversion in single sensor, wait until it completes and then it does the same with second sensor. More tricky approach of first idea is that you can let sensor in continuous mode and regularly writes it SYNC bit in configuration register. Method is easy but need implementation in MCU and most probably will cost you one or two timers of your MCU.

The second approach is easier to implement. MAX25405 has SYNC pin and can be configured for making this pin as input or output (or disable the feature). In output (master) mode it output some signal which can second sensor configured as input (slave) process. Slave assures that enables LEDs if and only if master do not drive SYNC signal.

Syncing Sensors

I implemented this in firmware and connected first sensor as a master and second as a slave. Configuration code look as follows (error checks are for simplicity omitted):

MAX25405_Configuration config;
MAX25405_GetDefaultConfiguration(&config);
config.mainConfig.modeOfOperation = MAX25405_ModeOfOperation_TrackingMode;
config.ledConfig.ledDrive = MAX25405_LedDrive_PWM_16_16;
config.ledConfig.enableDrivePwmOutput = 1;
config.ledConfig.columnGainMode = MAX25405_ColumnGainModeSelection_Internal;
config.mainConfig.enableEndOfConversionInterrupt = 1;
config.sequencingConfig.endOfConversionDelay = MAX25405_EndOfConversionDelay_12_49ms;
config.sequencingConfig.integrationTime = MAX25405_IntegrationTime_25us;
config.sequencingConfig.numberOfCoherentDoubleSamples = MAX25405_NumberOfCoherentDoubleSamples_8;

config.mainConfig.externalSyncMode = MAX25405_ExternalSync_Master;
MAX25405_SetConfiguration(&max1, &config);

config.mainConfig.externalSyncMode = MAX25405_ExternalSync_Slave;
MAX25405_SetConfiguration(&max2, &config);

Connecting sync signal

SYNC signals are exposed to pin header which is not placed by default. I had to solder it. For connecting sync signals of the sensor, you need to connect signals by jumper or other wire. It is good that signals are exposed to pin header. Instead of connecting jumper you can connect them to analysers like oscilloscope and easily look at it.

One Sensor “stopped” working

After I deployed new firmware withc synchronization configuration, I connected to the output again and see that flickering disappear from first (master) sensor, but second sensor (slave) stopped producing data. I was debugging it. If I removed jumper (and disconnect SYNC signal between two sensor) it start generating interrupts again, but when connected master worked well but slave do not generated any interrupt indicating new data collected. For some reason slave was blocked. I checked SYNC signal from master with logic analyser and signal look good. It was logic signal. Some time it was high and some time it was low. Later I was thinking about it and…

Timing Settings Requirements

Later I realized that when using synchronization there are some timing constraints. The issue which prevented slave collecting data was that time slot when master allowed slave to sense was too short. The condition is that slave sampling time must be shorter than master intermeasurement delay, otherwise slave will not have enough time to complete his sample and it abort collection in progress after master interrupt it. My initial settings were that both sensors was configured in a way that about 75% of time were sampling data (and IR LEDs were active) and sensor was sleeping for about 25% of time. In other words 25% of time was not sufficient for second sensor which also needed 75 % of time for completing measurement.

Resolution is simple but debugging took me some time. Easiest resolution is to increase delay between measurements or reduce time when sensor is sampling. I increased delay between measurements from 3.12ms to 12.49ms. 12.49ms is used in code above.

Result

After I fixed this issue, I was able to sense data from both sensor without any flickering. On the following video you can see this result:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Comparing results from two sensors

The reason why I did this experiment is that I want to see output from both sensor and compare if they produce exactly the same data or there are some differences. For a test look at following screen.

Experiment confirmed my hypothesis that there are differences. As you can see the sensor at right side produce systematically lower values. It is also visible on place where no subject was present (for example corners). Drift is about -200 to -300 in comparison to left sensor sensing the same (static in this case) scene. The difference is not very high but still is there. If you want to use two sensors in your design, you should not expect that data are exactly the same and rather pre-process them independently. There is possibility that MAX25405 is not the cause of a difference, but IR LEDs can also cause this drift.

Conclusion

This was my last blog as part of this competition. The only next blog will be my summary as part of this competition. In this blog I shown my experiment which I did and shown how to synchronize two sensors sensing the same scene for preventing interference between sensor, what are preconditions of timing configuration when syncing two sensors and finally, compared the data from two sensors. Using two sensors is feature with big potential but it is not possible to implement dual-sensor gesture detection as part of two-months long competition. Even implementing detection based on data from single sensor is quite complicated as I shown in previous blogs when I was describing my own algorithm, but it is good to know that MAX25405 has support for this and is designed in a way that it can be used in dual setup.

Next blog:  Blog #16: Misaz’s Experimenting with Gesture Sensors Summary

  • Sign in to reply
  • misaz
    misaz over 2 years ago in reply to colporteur

    It is a meccano type construction but it is not exactly mecano. It is merkur: https://www.merkurtoys.cz/ (sadly Czech only). It is very similar construction set to meccano but pitch is different. Merkur use metric 1 cm (10 mm) pitch.

    No part is 3D printed.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • colporteur
    colporteur over 2 years ago

    IS that a Mecano constructed sensor holder or did you do a 3D print job?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • misaz
    misaz over 2 years ago in reply to dougw

    Yes you can. I think there is more use cases of this feature. Sensor is mainly designed for automotive segment and some Maxim documents mention that it is deisnged for car entertainment panel control. I gues this use case requires sensing single hand from multiple angles because field of view can be limited in car environment in comparison with my desk where it even single sensor works fine.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dougw
    dougw over 2 years ago

    Interesting that you can get 2 sensors working simultaneously. I guess you could have one for each hand.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube