Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
public:crocs:arduino [2014-10-24 23:10] – [How to connect everything together] typo lnemec | public:crocs:arduino [2014-10-30 18:42] – lnemec | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Arduino ====== | + | ====== |
+ | |||
+ | * Date: 31. 10. 2014 | ||
+ | * Workshop by: Lukáš Němec | ||
+ | * Cake: we will see... | ||
+ | * Cake by: Mirek Jaroš | ||
+ | * Discussion on A403 wallpainting | ||
+ | |||
+ | ===== What to expect ===== | ||
+ | |||
+ | Introduction to microcontroller programming, | ||
+ | |||
+ | As we learn enough of theoretic background, you will get your hands on Arduino boards and you will have chance to program your own blinking LED or something similar, depending on your time, skill and enthusiasm. | ||
===== What to prepare ===== | ===== What to prepare ===== | ||
Line 13: | Line 25: | ||
===== Arduino Theory ===== | ===== Arduino Theory ===== | ||
{{ : | {{ : | ||
- | Arduinos come in many different flavours, from basic UNO to MEGA, or specialized one's, for example | + | |
+ | |||
+ | ==== Arduino Ecosystem ==== | ||
+ | |||
+ | Arduino is phenomenon of last few years, quickly gaining popularity | ||
+ | |||
+ | Today There is huge selection of boards, starting | ||
+ | |||
+ | Also open source design of Arduino is by many viewed as perfect point to start with own modifications, for example | ||
+ | |||
+ | Concerning accesoris, | ||
==== How to connect everything together ==== | ==== How to connect everything together ==== | ||
Line 29: | Line 51: | ||
Last category of pins are power pins, these are ground pins, 5V and 3.5V pins. Connect these to power breadboard power lines or components directly, as needed. | Last category of pins are power pins, these are ground pins, 5V and 3.5V pins. Connect these to power breadboard power lines or components directly, as needed. | ||
- | All other pins are used for special purposes, like reset pin or in case of smaller or older versions of arduino for actual programming. | + | All other pins are used for special purposes, like reset pin or in case of smaller or older versions of arduino for actual programming |
<note important> | <note important> | ||
Line 88: | Line 110: | ||
<note important> | <note important> | ||
- | <note warning> | + | <note warning> |
{{ : | {{ : | ||
+ | |||
+ | === Sensors, Analog input and Serial monitor === | ||
+ | |||
+ | Next example will show, how to read values from sensors and how to obtain debugging information from Arduino board. | ||
+ | |||
+ | In order to receive value from sensor, we have to use analog input pins (Arduino UNO has range from A0 to A5) and read values with analogRead function. There are many posibilities what to use as a source of input, you can choose from whatever is avaiable, rotary potentiometer, | ||
+ | |||
+ | Every sensor (save he more complicated ones) has basically three connections, | ||
+ | |||
+ | Next is serial output, which can be used either for debugging or logging values. Output needs to be inicialized in setup phase with following '' | ||
+ | |||
+ | <code C> | ||
+ | int sensorPin = A0; // select the input pin for the potentiometer | ||
+ | int sensorValue = 0; // variable to store the value | ||
+ | |||
+ | void setup() { | ||
+ | // | ||
+ | pinMode(sensorPin, | ||
+ | Serial.begin(9600); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // read the value | ||
+ | sensorValue = analogRead(sensorPin); | ||
+ | //print value on serial | ||
+ | Serial.println(sensorValue); | ||
+ | //wait | ||
+ | delay(1000); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | ===== How to continue ===== | ||
+ | |||
+ | ==== Ideas, where to get them ==== | ||
+ | As stated previously, idea is begining of everything, thus you need ideas what to do with Arduino. Hopefully you can come up with many of your own, but if you need some inspiration boost, following might help: | ||
+ | * Arduino Started Kit (book of 15 tutorials together with Arduino board and parts you will need) | ||
+ | * Other official Arduino Examples and already finished projects http:// | ||
+ | * Makezine videos, or paper issue: http:// | ||
+ | * many other, just search for " | ||
+ | |||
+ | ==== What to buy ==== | ||
+ | You will need something to start with, either you already have some electronics, | ||
+ | |||
+ | === Essential === | ||
+ | |||
+ | * Arduino Board | ||
+ | * some basic electronic parts (LEDs, resistors) | ||
+ | * breadboard | ||
+ | * jumper wires | ||
+ | |||
+ | === Nice to have === | ||
+ | |||
+ | * variety of sensors | ||
+ | * All other usefull parts (depending on project this can be servo motors of Liquid crystal display etc.) | ||
+ | * multimeter | ||
+ | * sothering iron (when you want to make project permanent) | ||
+ | * more Arduino boards (more projects at once becomes easier) | ||
+ | |||
+ | |||
+ | ==== Where to buy ==== | ||
+ | * Official Arduino strore - arduino.cc, based in Italy, sells Arduino boards, shields, sensors | ||
+ | * GM electronics - gme.cz, overpriced Arduinos, but nice for small parts like LEDs, based in Brno, so ideal if you are missing just one part to complete project | ||
+ | * dealExreme.com - dx.com, china based, cheap, not original Arduinos, but Funduinos etc. (so called Arduino compatible parts), takes about 4 weeks to arrive, ideal for stocking up on parts of budget buys of boards | ||
+ | |||
+ | ===== JeeNodes ===== | ||
+ | |||
+ | Jeenodes are special purpose boards (Arduino based) for WSN networks. Because of these facts, there is limited number of pins, and some other limitations, | ||
+ | |||
+ | First connections, | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | |||
+ | And now the other part, small change in source code: | ||
+ | |||
+ | <code C> | ||
+ | //pin placement is changed to 4 | ||
+ | int ledPin = 4; | ||
+ | |||
+ | void setup() { | ||
+ | pinMode(ledPin, | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | digitalWrite(ledPin, | ||
+ | delay(1000); | ||
+ | digitalWrite(ledPin, | ||
+ | delay(1000); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Other projects are changed acordingly. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||