Menu
O mnie Kontakt

W najnowszym filmie z kanału GreatScott! Dmitry omawia problemy związane z używaniem mikroprocesora HT66F002 w swoim projekcie. Jego projekt wykorzystuje czujnik odległości na podczerwień, mikrokontroler Arduino oraz diodę LED. Idea jest prostym mechanizmem kontrolowania jasności LED w zależności od odległości od czujnika. Jednak dla swojego projektu Dmitry potrzebuje stworzyć aż 14 takich układów, co może być kosztowne. Dlatego postanowił znaleźć tańszą alternatywę, a HT66F002 wydaje się być odpowiednią opcją ze względu na znaczną różnicę w cenie. Jednak problemem jest brak dostępnych materiałów dla początkujących, co skłoniło go do przetestowania możliwości tego mikroprocesora w swoim projekcie.

Film otwiera reklama sponsora – JLCPCB, popularnej platformy do zamawiania PCB. Dmitry podkreśla, jak prosta w obsłudze jest strona i jak można szybko otrzymać zamówione płytki. Następnie przystępuje do analizy wymagań dla swojego mikroprocesora, które obejmują możliwość pracy z pinami jako wejścia i wyjścia, generowanie sygnałów PWM oraz komunikację I2C z czujnikiem odległości. Po sprawdzeniu danych technicznych HT66F002, Dmitry stwierdza, że wiele z wymaganych funkcjonalności teoretycznie da się zrealizować, ale to nie będzie prosta sprawa.

Pierwszym krokiem było umieszczenie HT66F002 na płytce prototypowej, a następnie Dmitry musiał zdobyć programator E-Link. Programowanie rozpoczął od instalacji odpowiednich programów – HT IDE 3000 oraz HOPE 3000. Dmitry przedstawia jak krok po kroku przekształca podstawowy program mignięcia diody LED na HT66F002, a także napotyka problemy związane z timery i współdziałaniem z watchdog timerem, który hamował poprawne działanie. Po przebrnięciu przez przeszkody, Dmitry ratował sytuację wyłączając watchdog timer i uzyskując zamierzony efekt.

W kolejnych segmentach filmu Dmitry testuje inne funkcje, takie jak odczyty z potencjometru oraz wprowadzenie mikroprocesora w tryb uśpienia dla oszczędności energii. Na koniec dowiaduje się, że mikroprocesor HT66F002 nie wspiera komunikacji I2C w trybie master, co kończy jego plany dotyczące używania go w tym projekcie. Mimo że doświadczenia Dmitry'ego mogą wydawać się frustrujące, twierdzi, że film nie był bezsensowny, ponieważ uzyskane informacje mogą pomóc innym lepiej przygotować się na wyzwania związane z tanimi mikroprocesorami.

Jak widać, na chwile obecną film przyciągnął długą uwagę widzów, z 674,597 wyświetleniami i 21,539 polubieniami. Dmitry zachęca widzów do wsparcia jego pracy przez Patreon, a także do śledzenia kanału na mediach społecznościowych. Co ciekawe, pomimo wyzwań mikroprocesory HT oferują ciekawe zastosowania dla bardziej specyficznych aplikacji, co może bardzo zainteresować entuzjastów elektroniki. Jednak, biorąc pod uwagę sytuację dotyczącą braku dokumentacji i przewodników, wybór lepszego mikroprocesora może być bardziej przystępny. W finale Dmitry zapowiada, że już planuje swoje następne kroki w poszukiwaniu odpowiedniego mikroprocesora do swojego projektu.

Toggle timeline summary

  • 00:00 Wprowadzenie do projektu z wykorzystaniem czujnika odległości na podczerwień, Arduino i diody LED.
  • 00:20 Potrzeba powielenia ustawienia 14 razy budzi obawy dotyczące kosztów.
  • 00:38 Dyskusja na temat nieefektywności używania Arduino do projektu.
  • 00:53 Znalezienie mikrokontrolera HT66F002 jako opłacalnej alternatywy.
  • 01:30 Wyjaśnienie braku tutoriali dla HT66F002.
  • 02:36 Sformułowanie podstawowych funkcji wymaganych dla mikrokontrolera.
  • 03:38 Sprawdzenie arkusza danych mikrokontrolera potwierdza potencjalną funkcjonalność.
  • 04:15 Ustawienie mikrokontrolera na płytce rozwojowej.
  • 05:17 Rozpoczęcie pisania kodu do migania diodą LED.
  • 06:19 Rozwiązywanie problemów z diodą LED z powodu timera watchdog.
  • 07:15 Implementacja wejść przycisków do kontrolowania diody LED.
  • 07:45 Integracja PWM do regulacji jasności diody LED.
  • 09:09 Włączenie wejścia analogowego z użyciem potencjometru.
  • 10:09 Ustawienie trybu uśpienia w celu oszczędzania energii.
  • 10:46 Badanie ograniczeń mikrokontrolera związanych z komunikacją I2C.
  • 11:50 Podsumowanie doświadczeń programistycznych z mikrokontrolerami HT.
  • 12:52 Zachęta do sprawdzenia zasobów w opisie wideo.
  • 13:05 Uwagi końcowe i zaproszenie do wsparcia kanału.

Transcription

Now here's the problem. This right here is part of a big project I'm currently working on. We got an infrared distance sensor, an Arduino microcontroller and an LED. And as you would have guessed the closer we get to the distance sensor the brighter the LED gets. Sounds simple enough but the problem is that for the big project I need to build this setup 14 times and that can get expensive. Now using a cheaper distance sensor is not possible and I actually think its price is justified for what it can do. But we do not need such a big Arduino board or its ATmega 3280p microcontroller because it is way too overpowered with all of its features and also costs around two dollars per piece. So I searched through all corners of the internet to find a cheap alternative and I think I found one in the form of the HT66F002 that only costs around 0.2 dollars per piece which is a noticeable price difference. That of course sounds amazing but the next problem now is that unlike Arduino for which there exist thousands of tutorials and libraries online this microcontroller barely has any beginner's guides available. So the question is whether I can make this microcontroller work for my projects and that is exactly what we will be finding out in this video. Let's get started. Intro This video is sponsored by JLCPCB whose PCB service I used for many years and projects now. Their online platform is user friendly, easy to navigate and best of all you can receive your PCBs in just a week by using their fastest shipping option. If that sounds like your cup of tea then you can order their premium quality 1-8 layer PCBs starting at 2 dollars or even try out their 3D printing service starting at just 30 cents. And last but not least let me tell you a secret that their colorful silkscreen PCBs are coming soon so stay tuned. Now let's start off with finding out what the microcontrollers need to be able to do in my projects. The simplest thing would be using the pins as inputs and outputs meaning they can pull their pins high or low as an output to for example blink an LED or they can detect when their pins are getting pulled high or low as an input. Then we need to create a PWM signal with variable duty cycle which looks something like this on the oscilloscope. This is definitely mandatory to dim the brightness of LEDs. And while we're at it maybe it would be helpful to read the analog voltage of a potentiometer to dim the brightness of an LED accordingly which means we need an analog to digital converter. And last but not least a sleep mode would be beneficial to save a bit of power. And of course we definitely need to be able to use the I2C communication protocol to obviously communicate with our distance sensor. So yeah these are the main features I need for my projects and to find out whether my cheap microcontroller here can do them all I firstly checked its datasheets. And yes it seems like pretty much all functions are in theory possible to do except one that I will address later. And of course when comparing these specs to all the microcontrollers I already had a look at before then it is definitely not a powerhouse but certainly the cheapest option I ever looked at. So to get started with it I firstly sorted it onto a breakout board and next had to actually get myself another piece of hardware for it which is its dedicated programmer the E-Link. According to its manual you only need 4 FITS pins for programming which are VDD and GND for power and OCD-SCK and OCD-SDA for the data lines. Connecting those to the microcontroller was luckily super straight forward since the datasheet clearly states what pin connects where. And just like that it was time for programming for which I firstly had to install the HT IDE 3000 and the HOPE 3000 software. Now the IDE software is used to basically write your code, pretty much just like the Arduino IDE. And the HOPE software is then used to upload your created code to the microcontroller. And with that out of the way let's create our first project called Blink, select the HT66F002 and let's get started with coding a blinking LED. Now in Arduino language this is as simple as defining a pin as an output, pulling it high and low and waiting a bit in between. And luckily for me with the HT IDE it is not really hard to do either, the commands are just a bit different. For example with PAC1 equals 0 we set the PA1 pin seen here as an output and if we would say PAC1 equals 1 it would be an input. And by then pulling this pin high and low we should basically have a blink sketch. Right? Well sadly after compiling this code and then uploading it by clicking download, which worked wonderfully though even at the first try, my LED didn't feel like blinking properly. Now I probably spent around half a day figuring out what the problem was and tried solutions like decreasing the output current, adding capacitors and so on. Eventually though I realized that the watchdog timer was the problem which provides a device reset when its timer overflows. So after disabling it, my blink code finally worked like intended. And in case you are wondering what this code line here means, then it is basically used to alter the watchdog timer register, which I will need to do quite often with other registers as well. So if you want to know about that then definitely check it out in one of my previous videos. But anyway, next it was time for pushbutton inputs to for example turn on an LED which with the Arduino and its digital read function was super easy to do. And once again with the HTIDE it was also fairly simple to pull off. The only new function here is the PAPU one which enables a pull up resistor at the defined input pin. So after building this circuit up and uploading the new code, it worked perfectly fine, meaning the first mandatory feature was ready to practically use. Time to move on to the PWM one which if we look at Arduino programming is once again easy to pull off by using the analog write function in combination with an 8-bit value that constantly changes here to control the brightness of the LED aka the duty cycle of the PWM signal. When it comes to HT programming though this matter is definitely a whole lot more complicated because here we have to set up all the mandatory timer registers manually. Eventually though I ended up with a functional piece of code and the duty cycle can be changed here with a 10-bit variable. And after uploading this code you can see that it works just like the Arduino one and even features a higher frequency in direct comparison which was only around 490Hz before. Of course you could achieve a higher frequency with the Arduino as well by manipulating its timer registers and if you want to do that then check out my previous video about timers. But anyway PWM works and it was time for an analog input aka a potentiometer. And I feel like a broken record here by saying that Arduino makes it super simple to use this function. With the cheap microcontroller though it took me around 3 hours to manipulate the write register and then use bitmap to store the final analog voltage value in a variable that I can then pass over to the PWM function. But as you can see that was worth it in the end because I ultimately got it to work. And I think generally it is simpler to program with Arduino because there you got a serial interface meaning you can check at every point what the value of a certain variable is which makes troubleshooting so much easier. With my cheap microcontroller I cannot do that so it was a lot of trial and error. But either way ADC works meaning low power was next and here it was luckily easy to realize since this whole command puts the microcontroller into sleep mode. And by defining one input as a wakeup input you can bring the microcontroller back to life. Here you can see the final example which after blinking 5 times goes into sleep mode where I got the microcontroller current demand down to 11uA. And by pushing this button we basically turn it all back on and repeat this process. Nice. And that brings us to the last I2C feature which my small microcontroller is sadly missing. But luckily there are dozens of high tech microcontrollers out there and this HT66FO176 apparently comes with I2C and only costs around 30 cents per piece. So after soldering it on a breakout board and making sure that everything still works by uploading my PWM sketch it was time to dig into the I2C function. But sadly after around 1 hour I realized that this microcontroller along with apparently all other whole tech 8bit microcontrollers I could get a hold on only supports I2C in slave mode but for my project I need it as a master. This basically shattered my goal of using these microcontrollers for my projects and truth be told I only realized that after spending 3 days getting used to its programming. So was this video pointless in the end? I think not because now I know that the whole tech microcontrollers are not only cheap but also relatively easy to program for. And yes the IDE looks like Windows 95 but it is simple, free and does its job just fine. Combine that with the fact that they make lots of application specific microcontrollers like some for smoke detection, BLDC motors or even with a 24bit ADC and you got yourself some pretty compelling advantages here. But on the other hand though the programmer for the 8bit microcontrollers is quite pricey for a hobbyist. And like I said before there are not many libraries or guides around which are all in all my main complaints here. And if you want to use them for yourself then definitely check out the video description where I linked all good guides I found as well as all the codes I created in this video and a bit more. With that being said it is time for me to find another cheap microcontroller for my project and I think I already know what I will try next. Until then I hope you enjoyed this show and maybe consider supporting it through Patreon to keep it going. Don't forget to like, share, subscribe and hit the notification bell. Stay creative and I will see you next time.