Easy & Powerful Arduino Alternative? #3 Teensy Beginner's Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's say you just got yourself a rather powerful Singapore computer like this latte panda which hook up to portable LCD screen with this setup you can run Windows 10 easily and thus use this operating system to play some games now of course you could hook up an ordinary gaming controller to the system and play like that but if you later want to convert this setup into a Nintendo switch like hardware configuration you got yourself a problem since you would require controller inputs on the left and right sides and thus you would need to cut your game controller in half one solution to this problem is to place a micro controller in the middle and then simply connect you buttons and triggers to it from the left and right sides sadly though the macro controller of my trusty Arduino Nano does not feature a USB interface and thus cannot be easily utilized as a game controller but luckily tons of my viewers advised me to have a look at the teensy development boards which I did on their websites the one which interested me the most was the teens ELC not only because it features a native USB connection but also because it is the cheapest teensie for only $11.65 which is of course not as cheap as not we know nano which you can get for $3 but as long feature list should make up for its rights so in this video let's find out how easy it is to program and what advantages it offers in comparison to the Arduino Nano let's get started [Music] this video is sponsored by jl CPC beer where you can order PCBs with any color you like without paying any additional fees so feel free to upload your Gerber files and order your PCBs for only $2.00 when I ordered my teens ELC boards I did not only receive the development boards which was surprisingly even smaller than an Arduino Nano but also this welcoming piece of paper it not only tells us which pin serves which function and also which commands is necessary to use them but also that we should visit this URL to get started so I did just that and what I found was a well explained beginners guides and after reading through all kinds of tutorials for the sport I have to say that it is truly an easy-to-use microcontroller development boards and if you still got questions after going through all the given tutorials you can always ask in the teensie forum but anyway let's start off by downloading the teens heed we know application and installing it along above all the port libraries I especially like that they got the LCD outlets and fast LED library and in addition with the other included libraries you can already build a ton of projects and as soon as the installation was complete we can open the already installed odd we know idea to which now the teensy boards as well as deported teensy library scut edits at this point I connected the teens ELC through mic USB cable to my computer and started writing a simple blink led sketch which as you can see uses these same commands as you would use them for now tree no port once I was happy with it I chose the teens ELC boards but left all the other settings at their standard values and continued by verifying the sketch which alpha successful year automatically opens the teensie loader it told me to push the button on the boards to manually enter the programming modes which I could have done but instead I simply clicked upload in the arduino ide and thus it entered the programming mode automatically and as you can see our blink sketch works beautifully next I started the serial communication and used it to output the input state of pin 2 which after uploading connecting a wire to it and alternating its between the ground and 3.3 volt potential outputs its state over the serial monitor of the arduino ide Perfect's but make sure to not use 5 volts as an input since the tin zlc does not come with five full tolerant inputs it is also noteworthy that opens of the teensy feature pull-up resistors just like the arduino nano and speaking of similarities you can pretty much use all the available commands of the arduino ide directly or for the teensie which makes it super easy to use but let's continue it nevertheless with the tests by creating a simple PWM signal with a duty cycle of 50% at pin 3 as you can see after hooking the pin up to the oscilloscope we got our intended duty cycle of around 50% but sadly only with a frequency of 488 point 3 hertz the timer responsible for the signal is the FTM tool which offers a maximum resolution of 16 bits and of a clock frequency of 48 megahertz we should definitely be able to get better results than this the solution is to use the analog right resolution and analog right frequency function as an example I set the resolution to 12 bits and the frequency to 10 kilohertz and slowly increase the duty cycle which now goes from 0 to 4 hours 95 due to the higher 12-bits resolution as you can see on the oscilloscope the changed settings of the timer apparently increased the resolution as well as the frequency successfully but of course you cannot use a high resolution in combination with a high frequency but if you want more information on that then have a look at the linked teensie documentation in the video description the last analog right test I did was by creating a function that outputs sine wave values over 12 bits resolution on pin 26 now were for normal pwm pin the output signal would look like this with a varying duty cycle but the pin 26 outputs this a beautiful 12 bit sine wave the reason is that the teen zlc features a DAC or digital to analog converter which is very useful for many projects but moving on next I hooked up a potentiometer to 3.3 volts on one sides and ground on the other side while I connected the middle pin tune analog inputs by once again using pretty standard Arduino functions I was able to output the changing voltage at the analog pin through the serial monitor but once again this was only a 10 bit value even though the ADC or analog to digital converter supports up to 16 bits this solution was to once again alter the resolution with the analog redress function which worked like a charm next I set up an interrupt on pin tool of the teensie which activates when the pin gets pulled to ground and all it does while doing so is outputting the were triggered over the serial monitor after uploading you can see that by connecting the pin do grounds the function gets executed successfully and best of all you can attach an interrupt to pretty much opens of the last but not least I wanted to create a precisely timed events like I sometimes do in my Arduino projects by utilizing the timer registers of the atmega328p microcontroller of course for the teens year we could use those registers as well but to keep it simple and beginners friendly year we can also use the metro library to for example turn an LED on for 1 seconds and then turn it off for precisely 250 milliseconds as you can see after uploading the LED it does just dance but of course you could use the provided timer libraries of the teens year to even execute timer interrupts easily at this point we could go on by having a look at every single library year for the teens II or play around with the touch functionalities of the board but that is not really necessary because you should already understand that the teensy boards are the easiest to use arduino alternative i ever came across and defects that they are also quite powerful which you can see in this chart makes those boards even more appealing so to end this video let's get back to the game controller problem by adding two buttons and a joystick to the teens year digital pins and analog inputs by utilizing the joystick commands of the board's i assigned the x-axis to the analog stick and a button number to each digital inputs afterwards i simply selected the USB type as a joystick and uploaded decodes and just like that my teensy board got recognized as a game controller which means I can get back to working on my projects and you know that the teensie is an awesome development platform if you enjoyed this video don't forget to Like share subscribe stay creative and I will see you next time
Info
Channel: GreatScott!
Views: 298,280
Rating: undefined out of 5
Keywords: teensy, lc, arduino, alternative, easy, powerful, cheap, budget, beginner, guide, tutorial, how, to, make, project, ide, program, code, c++, teensyloader, teensyduino, library, libraries, pwm, pulse, width, modulation, timer, timers, analog, digital, read, write, fast, clock, speed, touch, usb, game, controller, joystick, button, input, output, lattepanda, psnow, frequency, duty, cycle, interface, electronic, electronics, greatscott, greatscott!
Id: 5yjdPbCac9g
Channel Id: undefined
Length: 10min 42sec (642 seconds)
Published: Sun Apr 28 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.