Close
0%
0%

Arduino Skillz

Week of Arduino

Similar projects worth following
This project teaches me a new Arduino-related skill/use every day (except Sundays and stat holidays...) I will start as a complete noob, using tutorials and other input sources, and see where it takes me!!

I will be working with the Arduino Nano form factor, as it is small and versatile. Plus its super cheap and I'm not afraid to summon the Blue Smoke demon with it.

Ok, I'm not going to start with 'Blink', but I will work my way through a new, more challenging Arduino project every day until I have created a robot army intent on world domination. Or something else that is almost as cool.

I am always looking for sponsors, as a process like this doesn't pay., so let me know if you have something you would like to contribute, hardware or software wise.

*DISCLAIMERS*

Some of these things I have already done, but will be documenting in log form. Good to keep track of my own progress and for others to follow along if they wish.

I will be using 'fritzing' diagrams. Please be aware that these diagrams are representations of the correct connections (mostly) and not a diagram of the most bestest routing.

I will also include components as they are used in the logs in which they are used, rather than listing and appending in the 'Components' section with every new project.

Also also included will be the code used to accomplish whatever feat of engineering I am attempting. I am not claiming any of this code to be mine, but listing the author (if names not found inside the code) wherever I can.

  • 1 × Arduino Nano

  • Project specific Arduino projects

    ken conrad02/17/2017 at 22:52 0 comments

    Most of these projects averaged about 2 hours, except for dumdum detector where each part took about an hour.

    The next Arduino project series will be a little more specific to some of the other projects I want to incorporate the Arduino Nano. I will link to them here.

    Thanks for checking out this project!!

  • Using an Arduino to flash ESCs

    ken conrad02/02/2017 at 04:20 0 comments

    By 'flash' I don't mean what I did here...

    I am trying to flash some escs with the right firmware to make them be able to reverse the direction of the BLDC they are driving... maybe it's a myth or a pipedream, but this is my adventure...

    Update:

    I got my BLDCs to turn in one direction, but one direction only. Not sure if it the firmware (trying to use SimonK latest 'reverse') or my ESCs or something else...

    Tools and Supplies::

    KKMulticopter Flash Tool - Flashing program

    ESC - I'm using a Q-Brain 4-in-1 20A, because it is what I had and it already had the SimonK Bootloader)

    Arduino Nano

    Some male-to-male jumper wires

    So the idea here is to make my Arduino Nano into a USB-run, one-wire ESC programming tool. According to what I have been able to glean from the interweb of assorted tutorials, all you need to do is plug the ground and signal wires from the ESC into the GND and D3 pins of the Nano. I also plugged the positive VIN on the ESC into the 5V pin on the Nano. This seems a lot easier than trying to figure out the pads on the ESC, making a tool or soldering wires to the ESC to program it with a USB ASP Atmel programming tool.

    1. Download KKMulticopter Flash Tool

    - check!

    2. Connect to Arduino

    Start up KKMulticopter Flash Tool (KKMFT) without your Arduino plugged in.

    Plug in Arduino via USB. KKMFT should recognize it and make the required adjustments of COM port and baud settings.

    - programmer option should be 'Arduino'

    - port option should be 'USB'

    3. Choose your controller - should be 'atmega 8-based brushless esc' option

    4. Choose the latest firmware version with the word 'reverse' in it under the 'firmware' option

    5. Hook up Arduino to ESC cable::

    The white wire - from D3 to ESC signal

    The red wire - from 5V to ESC positive

    The black wire - from GND to ESC ground

    6. Click on the green circle button to 'flash firmware from internet'

    That should do it?

    We will see when I get some motors hooked up tomorrow...

  • I2C shenanigans

    ken conrad01/31/2017 at 14:39 0 comments

    I want to use sensors. Probably more than one. So do you.

    New to I2C (Inter-Integrated Circuit) communications, the best place to start was a simple sketch that looks for I2C devices/connections. Without knowing if your device/connection is recognized, you may be failing and not understanding why. Often I think that I have done something wrong to find out (much) later that a device or component is malfunctioning. This code shows it's results in the serial monitor when run.

    // --------------------------------------
    // i2c_scanner
    //
    // Version 1
    //    This program (or code that looks like it)
    //    can be found in many places.
    //    For example on the Arduino.cc forum.
    //    The original author is not know.
    // Version 2, Juni 2012, Using Arduino 1.0.1
    //     Adapted to be as simple as possible by Arduino.cc user Krodal
    // Version 3, Feb 26  2013
    //    V3 by louarnold
    // Version 4, March 3, 2013, Using Arduino 1.0.3
    //    by Arduino.cc user Krodal.
    //    Changes by louarnold removed.
    //    Scanning addresses changed from 0...127 to 1...119,
    //    according to the i2c scanner by Nick Gammon
    //    http://www.gammon.com.au/forum/?id=10896
    // Version 5, March 28, 2013
    //    As version 4, but address scans now to 127.
    //    A sensor seems to use address 120.
    // Version 6, November 27, 2015.
    //    Added waiting for the Leonardo serial communication.
    // 
    //
    // This sketch tests the standard 7-bit addresses
    // Devices with higher bit address might not be seen properly.
    //
    
    #include <Wire.h>
    
    
    void setup()
    {
      Wire.begin();
    
      Serial.begin(9600);
      while (!Serial);             // Leonardo: wait for serial monitor
      Serial.println("\nI2C Scanner");
    }
    
    
    void loop()
    {
      byte error, address;
      int nDevices;
    
      Serial.println("Scanning...");
    
      nDevices = 0;
      for(address = 1; address < 127; address++ ) 
      {
        // The i2c_scanner uses the return value of
        // the Write.endTransmisstion to see if
        // a device did acknowledge to the address.
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
    
        if (error == 0)
        {
          Serial.print("I2C device found at address 0x");
          if (address<16) 
            Serial.print("0");
          Serial.print(address,HEX);
          Serial.println("  !");
    
          nDevices++;
        }
        else if (error==4) 
        {
          Serial.print("Unknow error at address 0x");
          if (address<16) 
            Serial.print("0");
          Serial.println(address,HEX);
        }    
      }
      if (nDevices == 0)
        Serial.println("No I2C devices found\n");
      else
        Serial.println("done\n");
    
      delay(5000);           // wait 5 seconds for next scan
    }

    Not only can you proceed with the sure knowledge your device is connecting, you will also know where it is connecting. The address of the device/module/connection is necessary in most sketches to make use of it.

    I get a message like this:

    ****

    Scanning...

    I2C device found at address 0x68 !

    done

    ****

    One of the common issues with learning Arduino is not realizing that you need to make changes to most sketches to make them work. Read the comments, follow the tutorial exactly if there is a good one.

    Sometimes it may be a good idea to make a physical list of the variables you will be using and the pins to which you want to connect. This way, when you are looking through the code, you can easily identfy potential issues.

  • I went to the Dark Side...

    ken conrad01/29/2017 at 16:15 1 comment

    I missed a day. I went to the dark side. They have pi there.

    Raspberry Pi has a place in my heart... It is the gadget that started my journey into the world of electronics. I made me feel like I could do it without any formal education. I was looking for ways to automate a fodder sprouting system to feed my milk goats (seriously, for real). Another story, another day...

    ANYWAYS, long story short, I had a show and tell and wanted to do a slide show, so I used my Pi B and this touchscreen setup to make it go. Again, tutorials that work are my favorites. This project was built using this instructable.

    Finished project::

    It was very straightforward:

    1. Start with all the regular Pi setup stuff.

    - flash an OS image (I used Raspbian Jessie)

    - update to latest distro

    2. Install feh

    sudo apt-get install feh
    3. Install screensaver
    sudo apt-get install xscreensaver
    All the screensaver configuration is done in terminal on a command line. The config I used was
    feh -Y -x -q -D 8 -B black -F -Z -z -r /media/

    And it should roll...

    There is a manual accessible by using the 'man feh' command..

    4. Configure Pi for touchscreen

    I had to add a step to get my screen to work, modifying the config.txt file in the boot directory of my Pi.

    cd ..
    cd ..
    cd boot
    sudo nano config.txt
    And the lines I added were:
    max_usb_current=1 
    hdmi_group=2
    hdmi_mode=1
    hdmi_mode=87
    hdmi_cvt 1024 600 60 6 0 0 0
    Over all, took me about 45 minutes, most of which was spent waiting for pi update and installs...

    Thats ok cause I spent that time in the most constructive way possible; playing slither.io. Look for me, I'm the snake? that is eating your dots.

    0r9@nD0n0r

  • Motorize

    ken conrad01/27/2017 at 22:26 0 comments

    Servos are cool, but they may not drive your high speed line-follower or help your cardboard box robot get around (I wish I had a video of the one I made... wifi controlled cardboard box... fun!)

    Today I am going to make a couple of brushed DC motors do my bidding.

    First thing to note is that if you want motors to go forwards and backwards, you need something like an H-Bridge controller. You want to know how an H-Bridge controller works? I am not going to tell you here. I have a very tenous grasp on the secret inner workings of the H-Bridge, so I am not qualified to give a lecture. BUT I will give you a diagram of how to wire one so it works...

    The motors I am using are encoded Roomba motors, but I am not using any encoding here. Just the black and red leads are hooked up.

    I choose to use the SN74410 chip rather than build out an h-bridge with resistors and crap. It can be done and there are lots of tutorials out there. Nice clean simple chips suit me fine.

    The tutorial *Dual Motor Driver* was instrumental in this project. It is specific to the SN74420 chip (interchangable with the L293D h-bridge chip). The code I used came from that guy too.

    Diagram:

    You might have seen the MPU-6050 from my last project in the video. It is just hanging out, not doing anything... YET.

    The black and red power leads are going to a 5V UBEC run off a 3s battery.

    *My fritzing diagrams do not show the best routing pathways. They are intended only to show the proper connections.*

    Code:

    // Use this code to test your motor with the Arduino board:
    
    // if you need PWM, just use the PWM outputs on the Arduino
    // and instead of digitalWrite, you should use the analogWrite command
    
    // —————————————————————————  Motors
    int motor_left[] = {4, 3};
    int motor_right[] = {7, 8};
    int ledPin =  13;    // LED connected to digital pin 13
    
    // ————————————————————————— Setup
    void setup() {
    Serial.begin(9600);
    
    // Setup motors
    int i;
    for(i = 0; i < 2; i++){
    pinMode(motor_left[i], OUTPUT);
    pinMode(motor_right[i], OUTPUT);
    pinMode(ledPin, OUTPUT);
    }
    
    }
    
    // ————————————————————————— Loop
    void loop() {
    
    drive_forward();
    delay(1000);
    motor_stop();
    Serial.println("1");
    
    drive_backward();
    delay(1000);
    motor_stop();
    Serial.println("2");
    
    turn_left();
    delay(1000);
    motor_stop();
    Serial.println("3");
    
    turn_right();
    delay(1000);
    motor_stop();
    Serial.println("4");
    
    motor_stop();
    delay(1000);
    motor_stop();
    Serial.println("5");
    
    digitalWrite(ledPin, HIGH);   // set the LED on
      delay(1000);                  // wait for a second
      digitalWrite(ledPin, LOW);    // set the LED off
      delay(1000);                  // wait for a second
    
    }
    
    // ————————————————————————— Drive
    
    void motor_stop(){
    digitalWrite(motor_left[0], LOW);
    digitalWrite(motor_left[1], LOW);
    
    digitalWrite(motor_right[0], LOW);
    digitalWrite(motor_right[1], LOW);
    delay(25);
    }
    
    void drive_forward(){
    digitalWrite(motor_left[0], HIGH);
    digitalWrite(motor_left[1], LOW);
    
    digitalWrite(motor_right[0], HIGH);
    digitalWrite(motor_right[1], LOW);
    }
    
    void drive_backward(){
    digitalWrite(motor_left[0], LOW);
    digitalWrite(motor_left[1], HIGH);
    
    digitalWrite(motor_right[0], LOW);
    digitalWrite(motor_right[1], HIGH);
    }
    
    void turn_left(){
    digitalWrite(motor_left[0], LOW);
    digitalWrite(motor_left[1], HIGH);
    
    digitalWrite(motor_right[0], HIGH);
    digitalWrite(motor_right[1], LOW);
    }
    
    void turn_right(){
    digitalWrite(motor_left[0], HIGH);
    digitalWrite(motor_left[1], LOW);
    
    digitalWrite(motor_right[0], LOW);
    digitalWrite(motor_right[1], HIGH);
    }
    
    I don't know about the PWM comments in the code. The motors I am using are 'supposed' to have PWM input, but work with the code as is. *shrug*

  • Mit Servo

    ken conrad01/26/2017 at 15:26 0 comments

    Adding a servo to any project makes it instantly cool. It's when code reaches out and touches the real world. Building on my last project, the MPU-6050, I have conneted to a servo and a change in attitude results in a change in servo position.

    I noticed some jitter, haven't yet figured out how to quell it yet. I tried using a capacitor across the servo power to no avail. Will look into other options and post results here.
    The positive and negative wires with no connection are actually connected to an external power source (5V). When activated connected to the 5V pin, the servo killed the Arduino, probably because of excessive current draw on servo start. I am using an 3S battery running a 5V UBEC. Should be sufficient to run a number of servos.

    #include "Wire.h"
    #include "I2Cdev.h"
    #include "MPU6050.h"
    #include "Servo.h"
     
    MPU6050 mpu;
     
    int16_t ax, ay, az;
    int16_t gx, gy, gz;
     
    Servo myservo;
     
    int val;
    int prevVal;
     
    void setup() 
    {
        Wire.begin();
        Serial.begin(38400);
     
        Serial.println("Initialize MPU");
        mpu.initialize();
        Serial.println(mpu.testConnection() ? "Connected" : "Connection failed");
        myservo.attach(9);
    }
     
    void loop() 
    {
        mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
     
        val = map(ay, -17000, 17000, 0, 179);
        if (val != prevVal)
        {
            myservo.write(val);
            prevVal = val;
        }
     
        delay(50);
    }

  • 6 degrees of freedom MPU-6050

    ken conrad01/25/2017 at 23:23 0 comments

    The MPU-6050 is a gyroscope/accelerometer chip. The one I have is on a handy breakout board. It has 8 pins, 5 of which I am going to use. The 3 I will not be using can be used to accept input from another sensor board.

    This chip is widely used for balance bots and quad/polycopters. It can also be used for wearable gesture analysis.

    I started my journey referring to this tutorial, but not because of it's title. It was the most complete tutorial I could find.

    https://diyhacking.com/arduino-mpu-6050-imu-sensor-tutorial/

    Part of this tutorial has you install a program called 'Processing 3'. It is a safe program that lets you see serial output in a customizable way. In this instance, using the Teapot sketch, you can see a representation of an airplane follow along with changes in the MPU sensor. Neat.

    Follwing the instructions given for the Arduino UNO, I came up with this diagram for hookup to the Nano:

    Please note that I used the 3.3V pin to power the sensor. Some have used 5V, but 3.3V is what the board I have requires.

    *This fritzing diagram represents the necessary connections, not necessarily the best routing*

    The code by Jeff Rowberg that I used for the Arduino:
    #include <I2Cdev.h>
    
    // I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class using DMP (MotionApps v2.0)
    // 6/21/2012 by Jeff Rowberg <jeff@rowberg.net>
    // Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
    //
    // Changelog:
    //      2013-05-08 - added seamless Fastwire support
    //                 - added note about gyro calibration
    //      2012-06-21 - added note about Arduino 1.0.1 + Leonardo compatibility error
    //      2012-06-20 - improved FIFO overflow handling and simplified read process
    //      2012-06-19 - completely rearranged DMP initialization code and simplification
    //      2012-06-13 - pull gyro and accel data from FIFO packet instead of reading directly
    //      2012-06-09 - fix broken FIFO read sequence and change interrupt detection to RISING
    //      2012-06-05 - add gravity-compensated initial reference frame acceleration output
    //                 - add 3D math helper file to DMP6 example sketch
    //                 - add Euler output and Yaw/Pitch/Roll output formats
    //      2012-06-04 - remove accel offset clearing for better results (thanks Sungon Lee)
    //      2012-06-01 - fixed gyro sensitivity to be 2000 deg/sec instead of 250
    //      2012-05-30 - basic DMP initialization working
    
    /* ============================================
    I2Cdev device library code is placed under the MIT license
    Copyright (c) 2012 Jeff Rowberg
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
    ===============================================
    */
    
    // I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
    // for both classes must be in the include path of your project
    #include "I2Cdev.h"
    
    #include "MPU6050_6Axis_MotionApps20.h"
    //#include "MPU6050.h" // not necessary if using MotionApps include file
    
    // Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
    // is used in I2Cdev.h
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        #include...
    Read more »

  • Rangefinding

    ken conrad01/25/2017 at 17:49 0 comments

    I am gong to redirect here to my stand-alone project 'DumDum Detector' because I have already put work into writing up that project.

    DumDum Detector

    http://bit.ly/dumdumdetector

View all 8 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates