-
[TOF] Detection now running at 150Hz with 3 sensors
11/08/2021 at 10:43 • 0 commentsBy integrating the Start Ranging and the Check on separate loops. The code can now run at full speed.
This allows us to reach 110Hz with 2 sensors, 150Hz with 3, 200 Hz with 4.int detect_All() { int range = 250; int distanceAll = MAX_DISTANCE_SHORT_DETECTION; for (int i = 0; i < NUMBER_OF_TOF_SENSORS; i++) { distanceSensor[i].setROI(16, 16, 198); distanceSensor[i].startRanging(); //Write configuration bytes to initiate measurement } for (int i = 0; i < NUMBER_OF_TOF_SENSORS; i++) { while (!distanceSensor[i].checkForDataReady()) { delay(1); } distanceAll = distanceSensor[i].getDistance(); //Get the result of the measurement from the sensor if (distanceAll >= MAX_DISTANCE_SHORT_DETECTION) { distanceAll = MAX_DISTANCE_SHORT_DETECTION; } distanceSensor[i].clearInterrupt(); distanceSensor[i].stopRanging(); if (distanceAll < range) { return 1; } } return 0; }
-
[CODE] Compatibility with Atmega328p
11/08/2021 at 09:57 • 0 commentsI just finished porting the code to run on an Atmega328p. This means that we can now use standard Arduino boards (UNO, Nano, Leonardo...)
For a question of integration in the box, I rather recommend using the NANO board.
#if defined(TEENSYDUINO) #define TOF_SDA 18 #define TOF_SCL 19 #define VL53L1X_1 17 #define VL53L1X_2 16 #define VL53L1X_3 15 #define VL53L1X_4 14 #elif defined(ARDUINO_SAMD_MKRWIFI1010) #define TOF_SDA 8 #define TOF_SCL 9 #define VL53L1X_1 7 #define VL53L1X_2 6 #define VL53L1X_3 5 #define VL53L1X_4 4 // #Arduino UNO, NANO, Leonardo... #else #define TOF_SDA A4 #define TOF_SCL A5 #define VL53L1X_1 A0 #define VL53L1X_2 A1 #define VL53L1X_3 A2 #define VL53L1X_4 A3 #endif
-
Arduino Code : Board management
11/07/2021 at 22:16 • 0 commentsMaking a generic project allows a maximum of people to reproduce it. That's why I tried to make it compatible with all kind of controllers, even the less powerful ones.
But I also use some specificities, only present on some controllers to bring more functionality to my project (USB-HID on Teensy, Wifi or Secure Element on MKR 1010).
To manage several boards in his Arduino project without having compilation problems, I used lines like this
#ifdef ARDUINO_SAMD_MKRWIFI1010 #include <WiFiNINA.h> #include <BlynkSimpleWiFiNINA.h> #endif
This will allow to include this library, only if I compile with a MKR 1010 target.
To manage features like USB HID, I now use this kind of code :
#ifdef USB_SERIAL Serial.println("PASSWORD"); #endif #ifdef USB_HID Keyboard.print("PASSWORD"); #endif
-
New algorithm for LCD moving object
11/07/2021 at 22:04 • 0 commentsWith my first algorithm, to move the circles of the eyes or the nose, I would redraw the previous shape in black and then I redraw it with color to its new position. This is a very simple way, but it make the screen a bit blinky...
From GFX Library, to move a "fillCircle()" in a direction, I used a hidden function called "drawCircleHelper()" to remove only a part of the border circle.
-
PCB Gerber available
11/07/2021 at 21:58 • 0 commentsI just finished the PCBs for the LCD/TOF interface board. The Gerber will be integrated in the repo
-
A simple 3D printed tool to position the connector at 15 degrees
11/07/2021 at 20:43 • 0 commentsThe sources are on the project repo
-
Add a secure element ATECC508
11/07/2021 at 19:29 • 0 commentsIn order to protect its data, the Arduino MKR 1010 implements an ATECC508. With a good implementation, this small device allows the integration of almost infallible security in the communication.
After some research, I found 2 Arduino libraries (ArduinoECCX08 and Sparkfun) allowing to integrate some functions of the ATECC508. WARNING: the configuration of the device is permanent. If you accept the default configuration of these libraries, you will never be able to change it again.
There are many ways to use this module, but these libraries focus on generating Public/Private key pairs and certificates to ensure the integrity of messages. There are already several tutorials to use these functions, I tested this one which worked well to connect to Google Cloud IOT with my Arduino MRK 1010. There is also this example to connect to Azure IOT Hub (but I didn't test it on MKR).
In our case, we would like to use ATECC508 to store private information (a pattern and a password). The SAMD21 would have to send Patterns to it and the ATECC508 would have to compare them with the one in memory. If this one matches, ATECC508 will send the password. (This part isn't finished yet !)
To integrate this, you must already understand the notion of configuration. Fortunately, the ATECC508 Datasheet is available on the internet (which is not the case for all secure elements, check for the complete datasheet with 109 pages). What we need is to set the correct configuration in "SlotConfig" (Section 2.2.1 SlotConfig (Bytes 20 to 51)) to enable "CheckMac" command (See section 3.2.7 Password Checking).
To use Password checking we need to configure ReadKey in the target SLOT to 0 (bit 3-0 of SlotConfig). This enable "CheckMac/Copy". If we check the default configuration of ArduinoECCX08 we have :
SLOT<0> : 0x83, 0x20, // External Signatures | Internal Signatures | IsSecret | Write Configure Never. This mean we have 0011 (0x3) as ReadKey instead of 0. So we need to configure a Slot with 0xX0, 0xXX
On datasheet we have "If the password is to be mapped to a secondary value (using the third option above), then the target slot containing this value is located in the next higher slot number (i.e. the password’s slot number plus one);"
So we can use
- SLOT<8> with 0x80, 0x00 to store the patern
- SLOT<9> with 0x80, 0x00 to store the secret password
I will not have time to test this part before the contest deadline. So I will finish this article after the contest.
The SAMD21 and the ATECC508 communicate with SPI on PA8 (SDA) and PA9 (SCL) or with One Wire with PA8 (SDA). We will use the SPI as it's the default configuration.
But the idea would be to use a PCB version so that you can continue to use the main controller you want. Here is an interesting guide
-
New project video !
11/07/2021 at 19:26 • 0 commentsIt was a lot of work, but the new video is online.
There is still a lot of footage from the first version, but it details the TOF concept better.
The first version is still available here :
-
Improve LCD resolution
11/06/2021 at 16:03 • 0 commentsA new screen has been integrated in GH to get a better rendering.
GH version 2 still has a 1.3" screen, but with 240x240 pixels (ST7789 library instead of ST7735).
But most of the photos and video presentations still have the old version.GH is 100% compatible with both versions, just by importing and calling the right library because it uses fonction to call current screen size :
tft.height() tft.width()
-
Improve speed/pixel of TOF Camera (2)
10/31/2021 at 12:40 • 0 commentsA new version of the VL53L1 is also available: VL53L1CB. It allows measurements at 60Hz up to 8 meters away. There is also the VL53L5CX witch give the opportunity to capture 8x8 pixels at 60Hz!
However, I had already bought several VL53L1CX, so I did my tests with this version (50Hz). So I decided to design a platform allowing to run 4 TOF in parallel in order to increase the performances (and thus the possibilities!) of my detection.
Here is the map I used to make these measurements. It includes 8 connection PINs.
- VCC
- SCK
- SDA
- XSHUT sensor 1
- XSHUT sensor 2
- XSHUT sensor 3
- XSHUT sensor 4
- GND
For a distance measurement, I made tests with a Teensy 3.6 card by timing 1000 measurements:
- 1 sensor: 18 seconds/1000 measure or 50Hz
- 2 sensors : 90Hz
- 4 sensors : 160Hz
This adapter card allows me to create a 64 pixels TOF camera at 2.5Hz if I tilt the sensors slightly (Fov 27°). But I can also use each sensor in the same direction and multiply the speed of motion detection.
Using the new VL53L1CB version, we should be able to reach a detection of 200Hz or a camera of 16 pixels at 12.5Hz