I don't know about you, but as a gamer, I grew up around multiple versions of Joysticks. And if you're a curious person like me, you're probably wondering how these Joysticks work. How does a controller sense that I moved the Joystick in a certain direction?
Not a gamer? Not interested in how most Joysticks work? Your loss. But at least you drive cars or are interested in them? Do you sometimes feel that you need to crank the volume up or change the track with help of the infotainment system or maybe tilt the side-view mirrors? Don't you wanna know a possible way how the car could sense, that you rotated any of those Knobs clockwise or anti-clockwise and act accordingly?
You got lost in the music and forgot which gear you were on? What do you do? You look in front of you and the number is there on the dashboard (well, assuming you drive a manual car, if it's automatic and you can't tell if you're on R or D or N, you might have a bigger problem) But how does the car sense the position of the gear-stick?
Most likely you find one of our Infineon 3D magnetic sensors:
- TLV493D-A1B6
- TLE493D-W2B6
- TLI493D-W2BW (crazy small)
- TLE493D-P2B6
The following picture showcases what the name of the IC stands for. For example:
I know you people love numbers and specs, so instead of reading the whole data sheet, have a look at the tables below underlining some important specs of the three 3D-Sensors.
Are these specs not enough for you? Why? Are you doing a Ph.D. in 3D-Sensors? Anyway, here are the links to their datasheets, if you need some more info:
2) Crash Course Hall EffectMost Hall Effect Sensors are devices that are activated by an external magnetic field. We know that a magnetic field has two important characteristics flux density, (B) and polarity (North and South Poles).
The output signal from a Hall effect sensor is the function of magnetic field density around the device. When the magnetic flux density around the sensor exceeds a certain pre-set threshold, the sensor detects it and generates an output voltage called the Hall Voltage, V_H. Consider the diagram below.
When the device is placed within a magnetic field, the magnetic flux lines exert a force on the semiconductor material which deflects the charge carriers, electrons and holes, to either side of the semiconductor slab. This movement of charge carriers is a result of the magnetic force they experience passing through the semiconductor material.
As these electrons and holes move sidewards a potential difference is produced between the two sides of the semiconductor material by the build-up of these charge carriers.
This is the basic concept of how most Hall effect sensors work. For the wisecrackers who want to know more about how the Hall Effect works, check out this article.
The 3D magnetic sensors use three of these Hall effect sensors in one package - thus being able to detect magnetic fields in all three dimensions.
You find TLI493D-W2BW, TLE493D-W2B6, and TLV493D-A1B6 on Infineon's 2Go Shields. TLE493D-P2B6 is currently only available as Kit2Go, therefore, this board is Plug & Play ready and no additional Microcontroller is needed.
Shield2Go boards feature a sensor on a breakout part followed by a standardized form factor and pinout defined by Infineon. All Shields2GOs are compatible with Arduino and the Arduino IDE. They also follow a Plug & Play principle i.e you can mount them on an XMC2Go microcontroller board and you're ready2Go. If you're using an Arduino Board or an XMC Board (using the Arduino Uno Pinout) you can use the MyIoT Adapter. (Click here to find out how to use the MyIoT Adapter)
Find the Shield2Go board layouts and pinouts below:
CAUTION: DO NOT ATTEMPT TO SOMEHOW CONNECT THESE SHIELDS2GO DIRECTLY WITH AN ARDUINO BOARD OR ANOTHER BOARD THAT OPERATES WITH 5V.THIS WILL CAUSE DAMAGE TO THE SHIELDS2GO, BECAUSE THEY HAVE A 3V3 OPERATIONAL VOLTAGE. SO MAKE SURE TO APPLY PROPER LEVEL-SHIFTING. (TheMyIoT Adapter does that automatically).
4) Available Add-onsTo show you the functions of the 3D Sense Shields2Go, while also using their dedicated libraries in the Arduino IDE later on in section 5, Infineon gets you five Add-ons to test and showcase the various, potential, typical applications of these 3D-Sensors:
- Rotating Knob with push function
- Joystick
- Small Joystick for the W2BW package
- Linear Slider
- Direction Indicator
- Power Drill trigger
- Tilting knob
- Out Of Shaft
Now if you want to save some money clean up that dusty, rusty 3D printer of yours. You can also print 3 of these add-ons yourself. Find out how in the next section.
4) Customizable and DIY Add-onsDo you choose to print them out or integrate them into your custom design?
Head over to the attachments section and download the STL files:
- Joystick
- Rotating Knob
- Linear Slider
You can also find these here.
Then you can pick a slicer of your choice. I used PrusaSlicer but it doesn't really matter which one you choose. If you're using PrusaSlicer then you can also use the following printing presets; they turned out to work fine:
As you can see Fig 4.1 was for the Linear slider parts, but all the other parts for the other add-ons had basically the same printing presets.
Finished with printing? Great, you're basically done. Now onto the assembly.
Starting off with the linear slider, because it's a bit more complicated than the other ones.
- You need to superglue the magnet (5x5mm neodym) into the hole of 3d_Linear_2_9. (take a look at Fig 4.1)
- Next, slide the slidingbar into the rectangular hole of 3d_Linear_2_9 as shown in Fig4.2.
- Then use an M1 Screw (length: 10mm) to screw the slidingbar to the 3d_Linear_1_6 as shown in Fig 4.3.
- Finally, slide the 3d_linear_4 into the 3d_linear_1_6 (See Fig 4.3)
- Optionally, you can also put the limiters (3d_Linear_3_1) on top of your sliding bar.
After the assembly you can screw it on top of your 3DSense Shield2Go with an M2 Screw (length: 10mm):
The other add-ons are pretty easy, you just have to:
- Glue the magnet for the joystick into the hole of the 3d_KugelstabSTL or the magnet for the rotating knob into the hole of the 3D_Drehknopf.STL (follow the red arrow below).
- For the pushdown function of the Knob, you'd have to insert a pogo pin first inside its dedicated hole of the 3D_Halter.STL as shown in Fig 4.4 below.
- After the magnets are in place, you take these models and just push them into Kugelhalter_3D_810_2.STL or 3D_Halter.STL respectively until it's in a stable state (follow the blue line below).
Use an M2 screw (length: 10mm) to attach the add-on on top of your Shield2Go.
Et voilà, you have your other two own Addons2Go:
I am going to use the MyIoT Adapter stacked on an Arduino Mega 2560 with the Shields2Go plugged into the MyIoT Adapter:
HINT: If you're using an XMC2Go or the Kit2Go variation of the 3D sensors, you might also want to try out this awesome app Infineon has developed (Take a look at the GIF-teasers below). Head over to the Attachments and you'll find a .zip folder named "3D Magnetic Sensors 2Go - GUI", download and install the software. This is basically a GUI for the add-ons mentioned in the previous section which gives you a quick demo about how to turn the coordinates extracted from the sensors into useful data for a specific application. When using a Shield2Go, all you have to do is mount the Shield2Go - with the add-on on top of it - onto the XMC2Go, then connect it to your PC via Micro-USB, start the application and choose which add-on you have on top of your 3DSense Shield2Go.
Now let's get this party started.
First of all, if you haven't got the Arduino IDE installed on your PC, please go ahead and install it from here. Also if you have not yet programmed an Arduino-compatible XMC Board e.g XMC2Go or XMC1100 BootKit etc., then please visit Infineon's GitHub page (click here) and follow their instructions, don't worry it's pretty simple.
Now after you've set up the Board so that Arduino IDE can recognize it, you can install the libraries you need. Hover over Sketch->IncludeLibraries and click on ManageLibraries and then type in the search bar the name of the Sensor you're using. For Example:
Now we have our working environment ready and we're good2Go -see what I did there?- Anyways, let me take you through the basic functions you'll most probably need when dealing with any of the three Shields.
First of all, you want to initialize the Sensor. That's done by globally defining an object and calling its constructor, depending on the sensor you are using, after including the libraries and before the setup(). The following table summarizes the basic methods you will probably use when dealing with any of the three sensors:
The cartesian coordinates are defined as follows:
These sensors also have Access modes which you can set in the setup()-function using the method:
setAccessMode(mode);
This is not mentioned in the table, because the access modes are not the same for every sensor, plus, their description is a bit long. So here are the available modes if you want to set them:
NOTE: You don't have to set the Access mode, it is set to a default mode, MASTERCONTROLLEDMODE (for TLE493D and TLI493D) and POWERDOWNMODEinitially (for TLV493D).
5.1) Wake up!...and maybe consume less!No, I'm not talking to you, I'm talking to the Sensors.
The three 3D Sensors generate an interrupt signal to the microcontroller to signal a finished measurement cycle. Now, the TLV493D-A1B6 does that always i.e whenever a measurement is ready it sends out an interrupt signal to the µC, that's because it doesn't belong to the WakeUp family.
Now for the Shields with a Wake-Up ability, the TLE493D-W2B6, and TLI493D-W2BW -the Sensors of the WakeUp Family- generate interrupts when the measurement passes a certain threshold defined by the user, so in the end, it consumes less power.
You can check if the WakeUp mode is enabled or not by the following method:
HINT: For the TLE493D-W2B6, it is enabled by default.
wakeUpEnabled();
and set the threshold by:
setWakeUpThreshold(x_high,x_low,y_high,y_low,z_high,z_low);
where the parameters are of the type float and represent the high and low boundaries of x, y and z coordinates respectively.
Here the adjustable range can be set with a ratio of size [-1, 1]. When all the measurement values Bx, By
andBz
are within this range, the Interrupt is disabled. If the arguments are out of range or any upper threshold is smaller than the lower one, the function returns without taking effect.
If you chose to consume less power by setting the access mode of the Sensor to LOWPOWERMODE, then you can also set the update rate which determines the frequency of the updateData() by using:
setUpdateRate(rate) // parameter of type uint8_t,
// ranges from [0,7],
// 0 being the fastest
REMEMBER to define an object of the sensor class you are using, before you call these methods.
Do you know how the newborn of the family gets all the attention and gets extra spoiled? That's how we treat our baby, TLI493D-W2BW. (Weird name for a newborn? I thought too till I saw Elon Musk's newborn baby's name)
Seriously, when dealing with the TLI493D-W2BW, you have some extra functionality e.g you can set the measurement range with:
Tli493d.setMeasurementRange(range);
whereas the parameter, range, can be:
- FULL (-160mT to 160mT)
- SHORT(-100mT to 100mT)
EXTRA SHORT (-50mT to 50mT)
This sets the magnetic range that can be measured. The smaller the range, the higher the sensitivity.
PARTY-POOPER: If you choose to use the EXTRA SHORT range, you will have to disable the WakeUp mode first for this sensor. Which brings me to the next point.
For the TLI493D-W2BW you can enable or disable the WakeUp mode with:
Tli493d.disableWakeUp();
// or
Tli493d.enableWakeUp();
and you can set the threshold like the TLE493D-W2B6, but also in milli Tesla (mT) or in LSB-format respectively with:
Tli493d.setWakeUpThresholdMT(x_high,x_low,y_high,y_low,z_high,z_low);
// or
Tli493d.setWakeUpThresholdLSB(x_high,x_low,y_high,y_low,z_high,z_low);
//of type int16_t, ranges from [-2048,2047]
Wow! This kid is really spoiled, huh?!
5.2) Simulation ToolInfineon has also provided a cool online simulation tool to give you a good overview or an expectation of the outcome when using the 3D Sensors for some applications e.g linear position measurement, angle measurement, and for the Joystick. It also gives an approximation of the error caused by e.g mechanical misalignment.
First, you'd have to give the tool some info as an input like magnet type, dimension, or application-specific parameters to allow it to set up your specific model. After providing the tool with the necessary info, hit calculate and wait for the simulation results. These results serve as appropriate information to optimize and accelerate further design activities.
After the calculation, you have the option to request a summary as a .pdf document or .tab file (you can open it with excel). The summary returns the calculation results while also telling you the input you've provided for the simulation tool. In some cases, the .pdf version offers you a supplier link to the magnet you've specified.
6) FarewellYou can check out the examples Infineon has integrated into the libraries for each sensor. You can do this by opening up the Arduino IDE and hovering over File->Examples->... under Examplescustomlibraries. There you'll find some pretty simple examples for the Shield of your choice, which you can Upload immediately on your Board. This way you can easily test out the different methods and access modes as well and monitor the output on Arduino's Serial Monitor.
So there you have it folks, TheThree3DSense Shields2Go. You might wanna check out the Window Opener. It features the TLE493D-W2B6 and showcases how it was used to help lock or unlock a Window and aid in opening, closing or tilting it wirelessly with your Smartphone. Also don't miss out on the 3DSense Kits2Go variation of our 3D magnetic sensors.
Comments