Здесь показаны различия между двумя версиями данной страницы.
arduino_2017 [2018/01/23 20:10] super_admin [Усилитель НЧ D-класс 2.1, 2х50Вт, 1x100Вт (TPA3116)] |
arduino_2017 [2019/06/24 20:29] |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
- | ====== Микропроцессорная плата Arduino ====== | ||
- | |||
- | |||
- | |||
- | ===== Справочные материалы по программированию Arduino ===== | ||
- | |||
- | * [[https://yadi.sk/i/5CMqjaQX3Qr3Ns | Справочник по языку программирования для Arduino (*.pdf)]] | ||
- | * [[https://yadi.sk/i/B4dNTU4g3Qr3hQ | Arduino - быстрый старт (учебное пособие *.pdf)]] | ||
- | |||
- | |||
- | ===== Практика программирования Arduino ===== | ||
- | ==== Урок 1. Знакомство с Arduino и Arduino IDE ==== | ||
- | * **Знакомство со средой разработки Arduino**. Открыть на компьютере среду разработки Arduino. Подключить Arduino к USB порту компьютера. Ознакомиться с разделами главного меню среды разработки. В меню //"Инструменты"// выбрать тип микропроцессорной платы и порт, к которому подключена плата. | ||
- | * **Разбор простейшей программы**, управляющей периодическим включением - выключением светодиода (генератор импульсов). Выбрать в меню учебный проект: // "Файл -> Примеры -> 01. Basics -> Blink"// | ||
- | * Доработать программу для управления двумя светодиодами (как мультивибратор ) или с тремя (как светофор). | ||
- | |||
- | **Дополнительные ссылки:** \\ | ||
- | * [[http://wiki.amperka.ru/конспект-arduino:маячок]] - Эксперимент 1. Маячок | ||
- | * [[http://edurobots.ru/2014/03/arduino-svetodiod/]] - Arduino для начинающих. Урок 1. Мигающий светодиод | ||
- | |||
- | **Кнопки** | ||
- | |||
- | * [[https://www.arduino.cc/en/Tutorial/Button]] | ||
- | * [[https://www.arduino.cc/reference/en/language/functions/digital-io/pinmode/]] | ||
- | * [[https://www.arduino.cc/en/Tutorial/StateChangeDetection?from=Tutorial.ButtonStateChange]] | ||
- | * [[http://wiki.amperka.ru/конспект-arduino:кнопочный-переключатель]] | ||
- | * http://robotosha.ru/arduino/connect-button-arduino.html - подключение кнопки к Arduino!!! (способы подавления дребезга контактов) | ||
- | |||
- | |||
- | <code c> | ||
- | // the loop function runs over and over again forever | ||
- | void loop() { | ||
- | if (digitalRead(ButtonPin) == LOW) { | ||
- | digitalWrite(LEDPin, HIGH); // turn the LED on (HIGH is the voltage level) | ||
- | } else { | ||
- | digitalWrite(LEDPin, LOW); // turn the LED off by making the voltage LOW | ||
- | } | ||
- | } | ||
- | </code> | ||
- | |||
- | **Дребезг контактов** | ||
- | |||
- | * [[https://youtu.be/XCNP_vRR_Z4]] - Кнопка с антидребезгом (Паяльник TV) | ||
- | * [[http://www.radioman.ru/teoria/1/mop_drebezg.php]] - подавление дребезга механических контактов с использованием триггера... | ||
- | * [[https://youtu.be/ROkX02k8lq0]] - лекция | ||
- | |||
- | |||
- | **Подавления дребезга механических контактов с использованием программных библиотек Bounce** | ||
- | |||
- | * https://github.com/thomasfredericks/Bounce2/wiki - программный способ | ||
- | * [[http://wikihandbk.com/wiki/Arduino:Библиотеки/Bounce]] | ||
- | |||
- | ==== Воспроизведение мелодий на Arduino ==== | ||
- | |||
- | * https://www.arduino.cc/en/Tutorial/PlayMelody -Play Melody | ||
- | * https://arduino-kit.ru/textpage_ws/pages_ws/proekt-10_--upravlyaem-pezoizluchatelem_-menyaem-ton-dlitelnost-igraem-muzyiku | ||
- | * http://www.instructables.com/id/Arduino-Tone-Music/ | ||
- | * http://tsibrov.blogspot.ru/2017/08/arduino-midi-drums.html - Arduino MIDI-drums - барабаны из Ардуино | ||
- | * http://tsibrov.blogspot.ru/2017/10/arduino-midi-drums-2.html | ||
- | * http://www.muzoborudovanie.ru/articles/midi/midi2.php | ||
- | |||
- | |||
- | * https://github.com/vishnubob/python-midi - Python MIDI | ||
- | * https://wiki.python.org/moin/PythonInMusic | ||
- | * http://www.pygame.org/docs/ref/midi.html | ||
- | * https://stackoverflow.com/questions/38938938/playing-drum-sounds-in-python-music21-library | ||
- | |||
- | * [[https://youtu.be/J8XNTHETgxU]] - | ||
- | |||
- | ==== Сирена на Arduino ==== | ||
- | |||
- | |||
- | * http://pzlezioniesercizionline.blogspot.ru/2015/10/tutorial-arduino-come-realizzare-la.html | ||
- | |||
- | {{::schema_sirena.jpg|}} | ||
- | |||
- | <code c> | ||
- | |||
- | Ecco lo sketch: | ||
- | |||
- | // Sirena della Polizia | ||
- | |||
- | int wait= 1; | ||
- | int time =10; | ||
- | int freq = 0; | ||
- | int ledPin1 =2; | ||
- | int ledPin2 =3; | ||
- | int tonePin =8; | ||
- | |||
- | void setup(){ | ||
- | pinMode(ledPin1, OUTPUT); | ||
- | pinMode(ledPin2, OUTPUT); | ||
- | } | ||
- | |||
- | void loop() { | ||
- | for (freq = 160; freq < 1700; freq += 1) { // valore iniziale, valore limite high, incremento | ||
- | tone(tonePin, freq, time); // Pin del piezo, frequenza, durata | ||
- | digitalWrite(ledPin1,LOW); | ||
- | digitalWrite(ledPin2,HIGH); | ||
- | delay(wait); | ||
- | } | ||
- | for (freq = 1700; freq > 160; freq -= 1) {// valore iniziale, valore limite low, decremento | ||
- | tone(tonePin, freq, time); | ||
- | digitalWrite(ledPin1,HIGH); | ||
- | digitalWrite(ledPin2,LOW); | ||
- | delay(wait); | ||
- | } | ||
- | } | ||
- | |||
- | </code> | ||
- | |||
- | |||
- | **Замена delay() для неблокирующих задержек в Arduino IDE** | ||
- | |||
- | https://habrahabr.ru/post/319184/ | ||
- | |||
- | https://github.com/nw-wind/SmartDelay | ||
- | |||
- | ==== ШАГОВЫЙ ДВИГАТЕЛЬ ==== | ||
- | |||
- | * https://github.com/simonmonk/raspirobotboard3/issues/17 | ||
- | * https://www.youtube.com/watch?v=jJQwmnyfw5k | ||
- | * https://youtu.be/Twgogd93x2c | ||
- | * https://lesson.iarduino.ru/page/upravlenie-shagovym-dvigatelem-s-arduiny/ | ||
- | * http://arduino-diy.com/arduino-shagovii-motor-28-BYJ48-draiver-ULN2003 | ||
- | * http://arduino-diy.com/arduino-shagovyy-dvigatel-osnovy | ||
- | * http://robotosha.ru/arduino/stepper-motor-28byj-uln2003-arduino.html | ||
- | * [[http://codius.ru/articles/Arduino_Uno_%D1%88%D0%B0%D0%B3%D0%BE%D0%B2%D1%8B%D0%B9_%D0%B4%D0%B2%D0%B8%D0%B3%D0%B0%D1%82%D0%B5%D0%BB%D1%8C_28BYJ_48_5V_%D0%B4%D1%80%D0%B0%D0%B9%D0%B2%D0%B5%D1%80_ULN2003_%D0%BD%D0%B0_%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B5_SBT0811 | Arduino Uno + шаговый двигатель 28BYJ-48 (5V) + драйвер ULN2003 (на модуле SBT0811)]] | ||
- | * | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ==== Полезные ссылки ==== | ||
- | * http://edurobots.ru/kurs-arduino-dlya-nachinayushhix/ - Курс «Arduino для начинающих» | ||
- | * http://wiki.amperka.ru/ - Учебные ресурсы на сайте amperka.ru | ||
- | ==== Наборы для изучения принципов создания киберфизических устройств на Arduino ==== | ||
- | Для изучения основ работы с платой Arduino можно использовать готовые наборы, содержащие не только необходимые электронные компоненты для проведения учебных экспериментов, но и сопроводительную брошюру с описанием учебных проектов, с исходным программным кодом, с электронными схемами киберфизических устройств. \\ | ||
- | |||
- | Наборы, которые удобно использовать в учебном процессе: | ||
- | * http://amperka.ru/product/matryoshka-z - Набор "Матрёшка - Z" | ||
- | * http://iarduino.ru/shop/Nabor/obuchayuschiy-nabor-po-arduino.html - Обучающий набор по Arduino | ||
- | * https://www.electronshik.ru/item/kit-nr05-2016109 - NR05 Азбука электронщика - Цифровая лаборатория (хорошая комплектация) | ||
- | Затрудняюсь отдать предпочтение какому либо из данных наборов, в каждом есть свои преимущества и свои недостатки. Для организации занятий в кружке элементов набора недостаточно, постоянно приходится пополнять список деталей, необходимых для учебных экспериментов... | ||
- | |||
- | ==== Воздушный насос ==== | ||
- | |||
- | [[http://dvrobot.ru/240/286/341/747.html]] | ||
- | |||
- | ===== Операционный усилитель LM358 ===== | ||
- | |||
- | * [[http://www.joyta.ru/5934-opisanie-i-primenenie-operacionnogo-usilitelya-lm358/]] - Описание и применение операционного усилителя LM358. Схемы включения, аналог, datasheet | ||
- | * [[http://cxem.net/beginner/beginner96.php]] Операционный усилитель? Это очень просто! | ||
- | * [[http://usamodelkina.ru/7899-prostoy-analogovyy-datchik-zvuka-dlya-arduino-svoimi-rukami.html]] **Простой аналоговый датчик звука для Ардуино своими руками** | ||
- | * [[https://myrobot.ru/forum/topic.php?forum=9&topic=126]] - микрофонный усилитель на LM358 | ||
- | * [[http://cxem.net/arduino/arduino146.php]] RGB светодиодная подсветка для пианино | ||
- | * [[http://chipmk.ru/index.php/12-izmerenie/160-prostoj-usilitel-termopary]] Простой усилитель термопары | ||
- | * [[http://arduino.ru/forum/apparatnye-voprosy/milliampermetr-na-arduino]] Миллиамперметр на Ардуино. | ||
- | * http://radioded.ru/proekty-na-arduino - распознавание голоса | ||
- | |||
- | |||
- | |||
- | * [[http://www.st.com/content/ccc/resource/technical/document/datasheet/61/46/87/01/98/ed/44/c5/CD00000464.pdf/files/CD00000464.pdf/jcr:content/translations/en.CD00000464.pdf]] - datasheet | ||
- | |||
- | * [[http://www.promelec.ru/catalog_info/54/134/541/331/]] - микрофоны | ||
- | |||
- | * https://geektimes.ru/post/268036/ - Делаем включение ПК по хлопку за вечер | ||
- | * http://cxem.net/arduino/arduino146.php - RGB светодиодная подсветка для пианино | ||
- | * http://www.instructables.com/id/RGB-LED-Piano-Lights/ | ||
- | * https://usamodelkina.ru/7899-prostoy-analogovyy-datchik-zvuka-dlya-arduino-svoimi-rukami.html | ||
- | |||
- | |||
- | |||
- | |||
- | ==== Усилитель НЧ D-класс 2.1, 2х50Вт, 1x100Вт (TPA3116) ==== | ||
- | |||
- | |||
- | https://www.electronshik.ru/item/kit-mp3117box-2564174 | ||
- | |||
- | <code> | ||
- | /* | ||
- | LiquidCrystal Library - scrollDisplayLeft() and scrollDisplayRight() | ||
- | |||
- | Demonstrates the use a 16x2 LCD display. The LiquidCrystal | ||
- | library works with all LCD displays that are compatible with the | ||
- | Hitachi HD44780 driver. There are many of them out there, and you | ||
- | can usually tell them by the 16-pin interface. | ||
- | |||
- | This sketch prints "Hello World!" to the LCD and uses the | ||
- | scrollDisplayLeft() and scrollDisplayRight() methods to scroll | ||
- | the text. | ||
- | |||
- | The circuit: | ||
- | * LCD RS pin to digital pin 12 | ||
- | * LCD Enable pin to digital pin 11 | ||
- | * LCD D4 pin to digital pin 5 | ||
- | * LCD D5 pin to digital pin 4 | ||
- | * LCD D6 pin to digital pin 3 | ||
- | * LCD D7 pin to digital pin 2 | ||
- | * LCD R/W pin to ground | ||
- | * 10K resistor: | ||
- | * ends to +5V and ground | ||
- | * wiper to LCD VO pin (pin 3) | ||
- | |||
- | Library originally added 18 Apr 2008 | ||
- | by David A. Mellis | ||
- | library modified 5 Jul 2009 | ||
- | by Limor Fried (http://www.ladyada.net) | ||
- | example added 9 Jul 2009 | ||
- | by Tom Igoe | ||
- | modified 22 Nov 2010 | ||
- | by Tom Igoe | ||
- | |||
- | This example code is in the public domain. | ||
- | |||
- | http://www.arduino.cc/en/Tutorial/LiquidCrystalScroll | ||
- | |||
- | */ | ||
- | |||
- | // include the library code: | ||
- | //#include <LineDriver.h> | ||
- | #include <LiquidCrystal.h> | ||
- | //#include <LiquidCrystalRus.h> | ||
- | //byte bukva_F[8] = {B00100,B11111,B10101,B10101,B11111,B00100,B00100,B00000,}; // Буква "Ф" | ||
- | // initialize the library with the numbers of the interface pins | ||
- | LiquidCrystal lcd(13, 12, 11, 10, 9, 8); | ||
- | |||
- | void setup() { | ||
- | // set up the LCD's number of columns and rows: | ||
- | lcd.begin(16, 2); | ||
- | // lcd.createChar(9, bukva_F); | ||
- | // Print a message to the LCD. | ||
- | lcd.setCursor(0,0); | ||
- | lcd.print("HOBA\xB1 \xA5H\xAAOPMAT\xA5KA! \xA8""EPE""\xA4""A""\xA1P\xA9\xA4KA!"); | ||
- | //lcd.print("\xE0\xE1\xE2\xE3\xE4\xE5\xE6"); | ||
- | //lcd.print("\xA0\xA1\xA2\xA3\xA4\xA5\xA6"); | ||
- | //lcd.print("\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0"); | ||
- | //lcd.print(" \xA8 p \xB8 \xB3 e \xBF"); | ||
- | //lcd.print("xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF/\xE1\xE2\xF7\xE7\xE4\xE5\xF6\xFA\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF2\xF3\xF4\xF5\xE6\xE8\xE3\xFE\xFB\xFD\xFF\xF9\xF8\xFC\xE0\xF1\xC1\xC2\xD7\xC7\xC4\xC5\xD6\xDA\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD2\xD3\xD4\xD5\xC6\xC8\xC3\xDE\xDB\xDD\xDF\xD9\xD8\xDC\xC0\xD1"); | ||
- | |||
- | delay(1000); | ||
- | } | ||
- | |||
- | void loop() { | ||
- | // scroll 13 positions (string length) to the left | ||
- | // to move it offscreen left: | ||
- | for (int positionCounter = 0; positionCounter < 30; positionCounter++) { | ||
- | // scroll one position left: | ||
- | lcd.scrollDisplayLeft(); | ||
- | // wait a bit: | ||
- | delay(300); | ||
- | } | ||
- | | ||
- | /* | ||
- | // scroll 29 positions (string length + display length) to the right | ||
- | // to move it offscreen right: | ||
- | for (int positionCounter = 0; positionCounter < 34; positionCounter++) { | ||
- | // scroll one position right: | ||
- | lcd.scrollDisplayRight(); | ||
- | // wait a bit: | ||
- | delay(300); | ||
- | } | ||
- | |||
- | // scroll 16 positions (display length + string length) to the left | ||
- | // to move it back to center: | ||
- | for (int positionCounter = 0; positionCounter < 16; positionCounter++) { | ||
- | // scroll one position left: | ||
- | lcd.scrollDisplayLeft(); | ||
- | // wait a bit: | ||
- | delay(300); | ||
- | } | ||
- | |||
- | // delay at the end of the full loop: | ||
- | delay(300); | ||
- | */ | ||
- | } | ||
- | |||
- | </code> |