Lesson 16 - Use of gyroscope ● Lesson 17 - Use of Bluetooth ● Lesson 18 - ESP8266 web server ● Lesson 19 - A naughty robot ● Lesson 20 - A remote control car 2020 ELECROW All Rights Reserved.
Instruction Instruction Welcome to the user manual of the Crowtail-Deluxe kit for Arduino. The electronic world is so exciting and amazing! Probably you can't wait to create more interesting works or even realize your electronic dream. Just wait a minutes, let’s get to know this amazing kit first. The Crowtail-Deluxe Kit for Arduino is a kit for advanced learners with a basic programming foundation.
Crowtail Welcome to the world of Crowtail! Crowtail is a modulated, ready-to-use toolset, it takes a building block approach to assemble electronics. It simplifies and condenses the learning process significantly. In our Crowtail warehouse, there are over 150 Crowtail modules and Crowtail shields! The Crowtail products are basic-functional modules that consist of a Base Shield and various modules with standardized connectors, each Crowtail module has its specific functions, such as light sensing and temperature sensing.
2 UART ports(D0&D1, D2&D3) that have a mark of “U”. These interfaces can be used for UART communication such as the WIFI module or Bluetooth module; 1 IIC ports(A4&A5) that have a mark of “I”. These interfaces are for the IIC Communication; Besides, there is also two motor connector, which you can drive 2 motors simultaneously or drive a 4-wire stepper.
Lessons Lesson 1 – LED Control Introduction Crowtail bright LED is a bright LED light with high brightness and a large angle. Then its low terminal resistance can be applied to indoor lighting, commercial lighting. Unlike colored LEDs, Crowtail bright led light is white, very similar to our daily light source and you can use it to make your own table lamp.
Page 8
What will you see When you press the switch, the bright LED will immediately light up, and the LED will go out when you press the switch again to make the switch button pop up. Code overview 1. Declare the LED and switch pins, and the “switchstate” variable to store the state of the button 2.
Lesson 2 – Collision experiment Introduction This is a Robot model car crash or collision switch sensor module for Arduino, it normally outputs a logic HIGH signal, but when the sensor crash something such as the wall, the on-board switch will be pressed, and the module outputs a logic LOW signal.
Code overview 1. Macro definitions of PIR motion sensor pin, LED pin and buzzer pin. 2. Declare a variable to store the state of the collision sensor. 3. Setup led and buzzer as output. 4. Read the state of the collision sensor and store it to the variable collisionState. 5.
Page 11
The output of the continuous-time switch Hall sensor output logic low(turns on) when a magnetic field (south polarity) perpendicular to the Hall sensor exceeds the BOP threshold, and it output logic high( turn off) when the magnetic field disappears. The Hall sensor is a very practical electronic module. It can be applied in many aspects, such as measuring displacement, measuring speed and so on.
Code usage Constant: const int taketime = 5000; 'const' is the abbreviation of constants. If you use this to define variables, the variables are marked as “read-only”, that is, they cannot be changed during the program. Constants are great for declaring pin number variables that will not change throughout the program.
Page 13
Our Crowtail-Motor Base Shield includes 2 motor interfaces, which can drive two motors at the same time! Of course, a 4-wire stepper motor can also be driven. After inserting the Crowtail-Motor Base Shield into Arduino/Crowduino, the specific method of controlling the motor is as follows: In this course, we will use the Crowtail-Motor Base Shield motor interface to control two TT motors simultaneously.
Page 14
Be careful not to connect the motor to the interval interface, such as OUT1 and OUT3, otherwise, the motor will not work properly. The complete connection is as follows. Open the P04_Motor_Control with Arduino IDE and upload it. Note: Because the motor consumes more power, after uploading the code, you need to provide additional power for the Crowtail-Motor Base Shield (usually connect 9V power supply for the power input port of the motor base shield) and then turn on the onboard power switch(you don’t have to power Crowduino/Arduino, because the motor base shield will share the power with Crowduino/Arduino).
Lesson 5 – Tracing experiment Introduction This IR reflective module emits the infrared light and then detects if the echo received, to estimates if there is an obstacle or not. It utilizes RPR-220 reflective photosensor modules, When no infrared light echo received, that is, there is no black obstacle in front of the sensor, this module output logic HIGH, and vice versa.
Page 16
positive and negative poles, and the OUT3 and OUT4 interfaces are connected to the same motor positive and negative poles. Be careful not to connect the motor to the interval interface, such as OUT1 and OUT3, otherwise the motor will not work properly. The complete connection is as follows. Open the P05_Tracing_Experiment with Arduino IDE and upload it.
Temperature Sensor and Crowtail-LED to D3 and D5 port of Crowtail-Motor Base Shield.The complete connection is as follows. Open the downloaded folder “Crowtail Deluxe Kit for Arduino demo code”, navigate to the folder “lib”, and add “Ds18b20” and “OneWire” folder to the Arduino library.
Page 18
What will you see Upload the program and then open the serial monitor, you will see the temperature of one wire waterproof temperature sensor is printing. When the temperature is higher than 40℃.the led will light on and it will light off when the temperature is lower than 40℃. Code overview 1.
Connect Crowtail-RGB-LED to D3 port of Crowtail-Motor Base Shield. The complete connection is as follows. Open the downloaded folder “Crowtail Deluxe Kit for Arduino demo code”, navigate to the folder “lib”, and add “Adafruit_NeoPixel” folder to the Arduino library. Open...
Page 20
Code overview 1. Import the RGB library. 2. Declare the pin of Crowtail-RGB-LED. 3. Create an RGB LED instance and select parameters for it. 4. Initialize the RGB strip. 5. Create functions that light up the RGB dots. 6. Call the function we create to show the RGB light. Code usage RGB library: #include <Adafruit_NeoPixel.h>...
Arduino IDE and upload it. What will you see You can see a larger "Elecrow" LOGO in the middle of the OLED and a smaller "www.elecrow.com" URL in the lower half of the OLED. Code overview 1. Import the OLED library and create an instance of OLED.
Code usage OLED Library: #include "U8glib.h" “U8glib.h” is a library of OLED, it has very comprehensive usage methods and functions for you to call and use OLED. So, first to includes the U8glib.h library into your program and then you can call the function directly inside the library to using the OLED.
Page 23
Shield. Connect Crowtail-OLED to A4&A5 port of Crowtail-Motor Base Shield. The complete connection is as follows. Open the downloaded folder “Crowtail Deluxe Kit for Arduino demo code”, navigate to the folder “lib”, and add “Ultrasonic” folder to the Arduino library.
6. If the distance is different from the previous distance, clear OLED and displays the new distance on OLED. 7. If the distance is the same as the previous distance, don’t need to upgrade the display on OLED. Code usage Import libraries: #include <Wire.h>...
Page 25
they are actually two potentiometers. The resistor is 10k for each. The joystick also has a push-button that is could be used for special applications. When the module is in the working mode it will output two analog values representing two directions. The value is restricted in a little smaller range (e.g 200~800)compared to the normal joystick, while it is around 1023 when the button is pushed so that the MCU can detect the action of pressing.In this lesson,we will print the working status of...
Code usage Analog input: xValue = analogRead(A5); yValue = analogRead(A4); Read the analog input of the thumb joystick. Why we don’t need to declare A4, A5 port as INPUT? As I said before, because Arduino pins are the default input mode, when the pin is input, we do not need to initialize the pin as input.
Page 27
A4&A5 port of Crowtail-Motor Base Shield. The complete connection is as follows. Open the downloaded folder “Crowtail Deluxe Kit for Arduino demo code”, navigate to the folder “lib”, and add “Servo” folder to the Arduino library. Open the P11_Servo_Control with Arduino IDE and upload it.
pin it is connected to. For example, our code is to connect the servo to D5 port. Servo rotation function: myservo.write(90); myservo.write(angle); The function of servo rotation. The prototype of this function is “ServoObject.write()”, The parameter in parentheses is the angular position you need the servo to rotate to, for our 180 degrees servo, the range of parameters you can enter is 0-180 degrees.
Page 29
Open the P12_Smart_Door with Arduino IDE and upload it. What will you see When you put your hand in front of the ultrasonic ranging sensor and make sure the distance between your hand and ultrasonic ranging sensor should less than 10 cm, you will see the servo will rotate to 170 degrees.
STEP1: Plug two Crowtail-Motor Base Shields onto two Arduino or Crowduino boards respectively. STEP2: Open the downloaded folder “Crowtail Deluxe Kit for Arduino demo code”, navigate to the folder “lib”, and add “IRSendRev” folder to the Arduino library. STEP3: Connect Crowtail-Infrared Emitter and Crowtail-Collision Sensor to D3 and D2 port of Crowtail-Motor Base Shield.
Page 31
The complete connection is as follows. What will you see Point the infrared transmitter towards the infrared receiver. When you press the collision sensor for the first time, the LED is on. When you press the collision sensor a second time, the buzzer will sounds. When you press the collision sensor a third time, the led goes out and the buzzer no longer beeps.
Array: unsigned char LED1[] = {15, 70, 70, 20, 60, 5, 1, 0, 0, 0,0}; Create unsigned char array. Its prototype is: Array name[].Arrays are a form of programming that organizes a set of elements of the same type in an unordered form for ease of processing. Unsigned char is an unsigned byte type.
Page 33
Hardware Connection STEP1: Plug the Crowtail-Motor Base Shield onto the Arduino or Crowduino board. STEP2: Connect Crowtail-I2C EEPROM to A4&A5 port of Crowtail-Motor Base Shield. The complete connection is as follows. Open the P14_Store_Data with Arduino and upload it. What will you see Open the serial monitor and you will see 20 "."...
Accelerometer(±16g) to A4&A5 port of Crowtail-Motor Base Shield. The complete connection is as follows. Open the downloaded folder “Crowtail Deluxe Kit for Arduino demo code”, navigate to the folder “lib”, and add “DigitalAccelerometer_ADXL345” folder to the Arduino library. Open the...
Page 35
Code overview 1. Import the I2C and accelerometer libraries and create an instance of ADXL345 accelerometer. 2. Initialize serial monitor and ADXL345 accelerometer. 3. Read the accelerometer values of three axis and store them in variables. 4. Print the accelerometer values of three axis. 5.
Lesson 16 – Use of gyroscope Introduction The Crowtail- Analog Gyro is based on an angular velocity sensor(Murata-ENC-03R) that uses the phenomenon of Coriolis force, which is generated when a rotational angular velocity is applied to. It provides 1-axis velocity with analog output. with precision and quick-response measurements, this module suitable for applications with position&...
Code overview 1. Import the math library and declare the pin of the analog gyro. 2. Declare variables to store the values of the analog gyro. 3. Setup the analog gyro as input and initialize the serial monitor. 4. In the setup() function, read the value from the analog gyro and use it as a reference value. 5.
Page 38
Crowtail - Motor Base Shield x1 Crowtail - Cable x2 Crowtail - Bluetooth Low Energy Module x1 Hardware Connection STEP1: Plug the Crowtail-Motor Base Shield onto the Arduino or Crowduino board. STEP2: Connect Crowtail-Bluetooth Low Energy Module to D2&D3 port of Crowtail-Motor Base Shield.
What will you see Open the serial port assistant software "HMComAssistant.exe" and select the Arduino port and set baud(115200) for bluetooth, then press “Open Com” and enter the data you want to send to bluetooth(1 or 0 in our demo code). Finally, press “Send” to send the data to control the LED on and off.
Page 40
It also has auto-reset so no noodling with pins and reset button pressings. To make it easy to use for portable projects, we added a connector for 3.7V Lithium polymer batteries and built-in battery charging. You don't need a battery, it will run just fine straight from the micro USB connector.
Page 41
1. Click the menu “Setting”, choose the ‘Comm Port Settings”, and it’ll popup an interface “Serial Advanced Setting”, you should set the port(The port of my board is 4, but yours may be different, you can check the port of the board in the port of your computer) for Crowtail-ESP8266 Node MCU and baud rate there.
Use overview 1. Open “LuaLoader.exe” software and set port and baud for Crowtail-ESP8266 Node MCU. 2. We can use “luaEditor.exe” software to open .lua file and edit code to control buzzer and LED through Crowtail-ESP8266 Node MCU. Of course, you can also program and control other electronic modules.
Page 43
Hardware Connection STEP1: Plug the Crowtail-Motor Base Shield onto the Arduino or Crowduino board. STEP2: Connect Crowtail-OLED to A4&A5 port of Crowtail-Motor Base Shield. Connect Crowtail-Ultrasonic Ranging Sensor to D2&D3 port of Crowtail-Motor Base Shield. Connect the two Micro-Speed Motor to the motor interface of Crotail- Motor Base Shield.
Code usage Create instant object: U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); Before you start using OLED, you need to initialize the OLED object. In fact, you need to tell which type of OLED is used(SSD1306), what is the pixel(128X64), and what is the type of communication between Arduino and OLED(U8G_I2C_OPT_NONE ).
Page 45
Crowtail - IR Emitter x1 Crowtail - Collision Sensor x1 Crowtail - IR Receiver x1 Crowtail - Cable x7 Crowtail - Thumb Joystick x1 Micro-Speed Motor x2 Crowtail - Bright LED x1 Jumper Wire x4 Hardware Connection STEP1: Plug the Crowtail-Motor Base Shield onto the Arduino or Crowduino board. STEP2: Connect Crowtail-Thumb Joystick to A4&A5 port of Crowtail-Motor Base Shield.
Page 46
What will you see Point the infrared transmitter towards the infrared receiver. When you press the collision sensor, the buzzer will beep and when the collision sensor is released, the buzzer will stop beeping. When you press the switch, the bright led will light on and when the switch button is pop up, the bright led will light off.
Need help?
Do you have a question about the Crowtail Deluxe Kit and is the answer not in the manual?
Questions and answers