When I seen the Infineon 3d Magnetic2Go sensor, I immediately thought it would be good to use as a speed sensor like those found on petal bikes. Even though you can buy a speed sensor for bikes, I though it would still be neat to build one.
When I first got this sensor, I was thinking it would be a little more difficult to program and use then it actually turned out be. Once you have your development env. setup, it was very simple to program.
Development Environment setupDownloads:
Setup
Now that everything is downloaded, its time to install all the software. First install the J-Link Software. I'm doing my development on a windows laptop, so it was just a matter of double clicking on the download and following the instructions.
Next if you dont already have the Arduino IDE install, go ahead and install that now. Again on windows its a pretty simple install.
Now for the libraries. I could detail out the instructions here, but Infineon did a great job with their instructions, I'm just going to say follow the instruction on their library links above.
Initial TestingNow that you have your development env setup, its time to connect the board to to your pc. This is simply connecting it to a usb cable and the other end to the pc.
If everything was setup correctly in your Arduino IDE, you should be able to open a sample project by going to
- File / Examples / Scroll down till you see TLE493D-W2B6 / Cartesian.
- Tools / Boards / Scroll till you see XMC1100 XMC2Go and select it.
- Tools / Ports / Select your port the board is running on, mine was com12
- Now build and upload the project
- Once done open the serial monitor and move a magnet around the sensor, you should see the values change in the serial monitor.
If that works, congratulations, you have a working development env. and board. Now we can get on to the actual project.
ProjectThis project in its current form doesn't require any extra hardware. The only things needed is the sensor, usb cable and a pc or phone capable of running processing code.
- First connect the sensor to the pc with the usb cable
- Upload the sensor code to the board
- Run the serial monitor and pass a magnet by the sensor a few times to mimic a tire spinning
- Values should show up on the serial monitor
- Start processing ide and run the processing code
- A screen showing a speedometer should be displayed and passing the magnet by the sensor again should make the speedometer needle move
- In the future, I would like to add a BlueTooth LE module to the board and connect to the sensor using a mobile phone. The processing code should run on android allowing you to hook the sensor up to a bike wheel and running the sensor of a small battery.
- A way to input the diameter of the wheel at run time would be nice
While working with this sensor, my sensor readings seem to be a little jumpy. I tried a few different way to fix this, but what I ended up with seem to work the best. I'm not sure if a stronger magnet would make it work better but it also did give a little better result.
ConclusionI can see a lot of uses for this sensor. Its tiny and requires very little power.
While working with the sensor, I had received a 3d printer kit. I think this sensor would work very well for creating a way to level the hot bed. And it may very well be my next project with it.
Thanks
Comments