Model Boat Mayhem - Forum

Please login or register.

Login with username, password and session length.
Pages: [1]   Go Down

Author Topic: XRAD'S Electronic Designs  (Read 541 times)

xrad

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 564
  • Keeper of the Sun Dried Tomato
  • Location: Ohio USA
XRAD'S Electronic Designs
« on: September 17, 2018, 01:29:36 PM »

Cool LIDAR!So with a bit of coding, I combined and Adafruit 1.8TFT with a teensy 3.2 and a TFMini 'lidar' device. Came out great, Just need to add sound and and some button actions to change range from 10m to 5m etc...Right now, the TFMini is hot glued to a servo aimed into a corner. The distance is pretty accurate. It originally is decoded into cm's. I converted this to decimal meters. Also, some of the original code for the scan display was set to 40cm, so this had to be modified, as well as all the code to convert ping.h to TFMini.h. Some of the original code was designed for the sparkfun ultrasonic transducer, which of course has way too short a range for my needs. This TFMini transducer is pretty accurate (within 1cm) when I first tested it. Honestly, the hardest part was just getting the teensy to display on the TFT. Had to update my libraries....

The LIDAR is obviously not a real laser system, but IR.  Works really well. I coded a few options into the mix, including some sounds and lights. A warning beep of various pitch goes off when object distance is less than 6.5m and higher beep when less than 3m.  Would make for a cool functioning radar display in a ship. You could modify the code to run 360 degrees or whatever.


The foundation code for the ultrasonic version can be found here:
http://richmondsystems.net/2017/08/27/arduino-radar-using-arduino-nano-and-tft-screen/

TFMini basic distance.ino and libraries can be found here:
https://learn.sparkfun.com/tutorials/tfmini---micro-lidar-module-hookup-guide?_ga=2.39071140.669972668.1536969373-1149551590.1533509181&_gac=1.178577808.1535748160.EAIaIQobChMImLjw2pOY3QIV17jACh2CmgxQEAAYAiAAEgL0AfD_BwE

You will need three libraries and the newest arduino IDE.  The most complex part of the code is how to draw the 100 pixel long 'radar' sweep radius at a certain position and certain arc. I edited much of the code out (all the 'ping' code) and was able to add the TFMini 'distance' code.  The main loop has pretty much a screen wipe followed by a left and then right sweep blocks and of course distance calculations to be displayed.  FUN!!


#include <Servo.h>
#include <TFT.h>
#include <TFMini.h>


See video:https://www.youtube.com/watch?v=TQYZ23f ... e=youtu.be


Logged

grendel

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,501
  • Location: Canterbury, Kent, UK
Re: XRAD'S Electronic Designs
« Reply #1 on: September 17, 2018, 03:55:23 PM »

I will follow this with interest having picked up an arduino clone (mega 2560) at the boot fair for 5 (complete starter kit never unpacked) at the weekend, I will be starting to learn how to program it soon.
Logged

xrad

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 564
  • Keeper of the Sun Dried Tomato
  • Location: Ohio USA
Re: XRAD'S Electronic Designs
« Reply #2 on: September 17, 2018, 04:46:01 PM »

I have had good success with the arduino clones. There are some cool arduino 'kits' out there from china which contain a ton of add ons for little $$.  I personally have switched to the Teensy 3.2. 19$ US . It holds a lot of code and processes very fast but there are a few other things needed to run it(it has 3 serial RxTx ports which is very helpful if you want to run 3 devices). Also, I have had luck with arduino NANO and of course the adafruit TRINKETs.  Adafruit site has some easy cool projects and plenty of great write-ups. they are especially good with the assignable LED projects. 

First thing to do is read through the https://www.arduino.cc/en/Guide/HomePage

The newest IDE comes with a ton of the basic libraries. Adafruit has their own libraries.  Easy to install/update libraries though the arduino IDE. 

Warning: Watch your processor logic voltage, 3.3 v 5.  You can fry your processor if hook up wrong. This is not the operating voltage which is usually 5-7v.

Then you get to learn the digital vs analog control of anything......
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 690
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: XRAD'S Electronic Designs
« Reply #3 on: September 17, 2018, 04:58:34 PM »

Great project ...
C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...
Pages: [1]   Go Up