Skip to content

3D Printed Add Ons

jaenrig-ifx edited this page Nov 5, 2020 · 2 revisions

Introduction

Infineon offers several 3D printed mechanical add-ons to be used in combination with the shield2go form factor products. These allow for quick and easy application evaluation of the different Infineon magnetic sensors.

Find more about them in the boards section of the magnetic sensors product page.

OpenClose2Go Add-On

In this section, we present the OpenClose2Go Add-On. Which can be use in combination with the hall switches S2Go product family.

The add-on includes the mechanical 3D printed hardware and a magnet. A little force feedback function is implemented with further magnets, but not mandatory for the function.

This simple Add-On will easily illustrate you the functionality of an open-close functionality. Adressable appliations are:

  • Open window detection for safety or security reasons
  • Door state of a dishwashers or fridge
  • Simple pressed button function detection
  • ...

On the Infineon page the 3D print files can be downloaded after registration to your convenience.

Quick Start Example

Installation

First, if you are unfamiliar with XMC Arduino ecosystem and this product, please go through the Arduino Getting Started. The same hardware will be required as well, plus (of course) the OpenClose2Go Add-On. In case of the software, for this example, the hall-switch Arduino library does not need to be installed, you can directly use the code example provided below.

How does it work?

By approaching the sensor with the magnet, the magnetic field increases and exceeds a sensor specific threshold -> the sensor changes the state. The LED on the XMC1100 indicates the state of the sensor in addition after flashing the example code to the uC. This example shall show how easy this detection can be.

Code

Create a new Arduino Sketch and copy the following code:

int state=LOW;
  
void setup() {
    // put your setup code here, to run once:
    Serial.begin(9600);
    pinMode(14,OUTPUT);
    pinMode(9,INPUT);
    Serial.println("Start");
    digitalWrite(14,HIGH);
    delay(1000);
    digitalWrite(14,LOW);
}

void loop() {
    // put your main code here, to run repeatedly:

    state=digitalRead(9);
    Serial.print("State: ");
    Serial.println(state); 

    digitalWrite(14,state);
    delay(100);
}

⚠️ Remember to select the proper XMC1100 2Go board before verifying and uploading your sketch ;)