Programming – Kevin Gulling http://www.kevingulling.com Game Development, VR, and more Mon, 06 Nov 2017 23:07:25 +0000 en-US hourly 1 https://wordpress.org/?v=5.9.13 81085834 Arduino GY-MAX471 Voltage and Current Testing Module https://kevingulling.com/2017/03/arduino-gy-max471-voltage-and-current-testing-module/ https://kevingulling.com/2017/03/arduino-gy-max471-voltage-and-current-testing-module/#comments Tue, 28 Mar 2017 15:26:18 +0000 https://kevingulling.com/?p=1543 The GY-MAX471 Voltage and Current Sensor Module I found another cheap, interesting module on ICSTATION. This one utilizes the MAX471 chip to sense the voltage and current running through the circuit. The datasheet for this module is non-existent as far as I can tell, but there is a datasheet for the MAX471, so with some […]

The post Arduino GY-MAX471 Voltage and Current Testing Module appeared first on Kevin Gulling - Game Development, VR, and more.

]]>
The GY-MAX471 Voltage and Current Sensor Module


I found another cheap, interesting module on ICSTATION. This one utilizes the MAX471 chip to sense the voltage and current running through the circuit. The datasheet for this module is non-existent as far as I can tell, but there is a datasheet for the MAX471, so with some guess work I hooked it up to my UNO.

This is all the info about the module itself that I could find:

1.Size:19.5*20.3mm
2.Test Voltage range:DC 3-25V (Arduino work on 5V) or DC3-16.5V (work on 3.3V)
3.Test Current range:DC 0-3A
4.Chip: MAX471

There are similar modules that also utilize the MAX471 with a little bit more documentation available (this video for example), but this one has a couple major differences from other similar modules. The header pins are arranged in different order, and there are a couple more terminals.

I was getting a constant reading of 0 from the OUT pin, which I am assuming is the current reading. This was likely due to the fact that I was not drawing enough amperage with the LED to trigger a result. It could also be that something is not working correctly, I would have to test it out with something that draws more a few hundred mA or more to be sure. If I ever get around to that I’ll be sure to update this article and post the results.

In the video below you can see the GY-MAX471 in action:

youtube link

arduino sketch screenshot

GY-MAX471 Voltage/Current test sketch

The sketch for voltage test only:

#define vtpin A0
#define Arduino_Voltage 5.0

void setup() {
pinMode(vtpin, INPUT);

Serial.begin(9600);

}

void loop() {
int v = analogRead(vtpin);
double voltage = v * (Arduino_Voltage / 1023.0) * 5;

Serial.print(voltage);
Serial.println('v');

delay(3000);
}

The sketch for voltage and current test:


#define vtpin A0
#define atpin A5
#define Arduino_Voltage 5.0

void setup() {
pinMode(vtpin, INPUT);
pinMode(atpin, INPUT);
Serial.begin(9600);

}

void loop() {
int v = analogRead(vtpin);
int a = analogRead(atpin);

double voltage = v * (Arduino_Voltage / 1023.0) * 5;
double current = a * (Arduino_Voltage / 1023.0);

Serial.print(voltage);
Serial.println('v');
Serial.print(current);
Serial.println('A');

delay(3000);
}

The sketch for voltage current and watts:


#define vtpin A0
#define atpin A5
#define Arduino_Voltage 5.0

void setup() {
pinMode(vtpin, INPUT);
pinMode(atpin, INPUT);
Serial.begin(9600);

}

void loop() {
int v = analogRead(vtpin);
int a = analogRead(atpin);

double voltage = v * (Arduino_Voltage / 1023.0) * 5;
double current = a * (Arduino_Voltage / 1023.0);
double watts = current * voltage;

Serial.print(voltage);
Serial.println('v');
Serial.print(current);
Serial.println('A');
Serial.print(watts);
Serial.println('W');

delay(3000);
}

In summary, this is a pretty handy module. But do beware, in the MAX471 datasheet from the company maxis, they warn that they have discontinued production of the max471 chip, so don’t base any new designs off of it. So if you are using this in single project that doesn’t have to be reproduced many times, this is great option for testing the voltage and current, but if you are looking to prototype something that will eventually go into production, it’s probably best to look elsewhere for a way to handle this. I personally think it’s going to work great for my robotics project where I will run a shutdown sequence if the circuit is under-powered due to a low battery charge.

The post Arduino GY-MAX471 Voltage and Current Testing Module appeared first on Kevin Gulling - Game Development, VR, and more.

]]>
https://kevingulling.com/2017/03/arduino-gy-max471-voltage-and-current-testing-module/feed/ 9 1543
RCWL-0516 Microwave Radar Motion Sensor for Arduino Test and Review https://kevingulling.com/2017/01/rcwl-0516-microwave-radar-motion-sensor-for-arduino-test-and-review/ https://kevingulling.com/2017/01/rcwl-0516-microwave-radar-motion-sensor-for-arduino-test-and-review/#comments Thu, 26 Jan 2017 15:33:31 +0000 https://kevingulling.com/?p=1486 RCWL-0516 Sensor Test & Review The RCWL-0516 microwave radar motion sensor module is a low cost sensor that has been newly added to ICSTATION inventory. There is quite a lack of information on the module online, at least not that I could find, so I’m compiling what I could find and posting it all here […]

The post RCWL-0516 Microwave Radar Motion Sensor for Arduino Test and Review appeared first on Kevin Gulling - Game Development, VR, and more.

]]>
RCWL-0516 Sensor Test & Review

rcwl-0516

The RCWL-0516 microwave radar motion sensor module is a low cost sensor that has been newly added to ICSTATION inventory. There is quite a lack of information on the module online, at least not that I could find, so I’m compiling what I could find and posting it all here in this article.

Distance Test

video of rcwl-0516

RCWL-O516 Arduino Circuit

rcwl-0516 arduino

RCWL-0516 Arduino Uno Circuit

We only use 3 of the 5 header pins in this project.

  • 3V3
  • GND – [connects to ground]
  • OUT [connects to digital input]
  • VIN – [connects to 5v]
  • CDS

The 0516 is a flexible module that can easily be used in conjunction with many MCU’s and even without a microcontroller at all. It can handle anywhere from 4v-28v in, which it then converts and outputs 3.3v to the 3V3 pin. This pin can be utilized for a multitude of tasks, such as an LED to indicate power, or even to supply power to a mini 3v based MCU.

Change the resistor value to decrease sensitivity. I have a 220Ω resistor in the circuit which shouldn’t impede the sensitivity too drastically, I’ll play around with some other values and update with my findings.

RCWL-O516 Arduino Sketch

Click to enlarge


int ip = 8;
int val = 0;
int led = 13;

void setup() {
Serial.begin(9600);
pinMode (ip, INPUT);
pinMode (led, OUTPUT);
}

void loop() {
val = digitalRead(ip);
Serial.println(val, DEC);
if(val >0)
{
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
delay(1000);

}

To make the reaction time faster you can reduce the delay time from 1000 to something like 100. This will also allow the sensor to pick up smaller movements. Conversely you can increase the delay to help keep small movements from triggering (this is a simple but not perfect way of accomplishing this effect), and make the circuit conserve more power.




Disclaimer: I could not find an official datasheet on this module, so I’ve had to make some guesses here. I’m not responsible for any damage this could cause to your Arduino or sensor module! If you choose to try this yourself, don’t blame me when you spontaneously combust!

For even more info check out the git by Joe on it here which is still in the works (as of jan 2107) but it looks like he’s keeping it up to date with new findings: https://github.com/jdesbonnet/RCWL-0516/

The post RCWL-0516 Microwave Radar Motion Sensor for Arduino Test and Review appeared first on Kevin Gulling - Game Development, VR, and more.

]]>
https://kevingulling.com/2017/01/rcwl-0516-microwave-radar-motion-sensor-for-arduino-test-and-review/feed/ 4 1486
Arduino + SPO2 Pulse Oximeter + Unity3D – Teardown Tuesday https://kevingulling.com/2017/01/arduino-spo2-pulse-oximeter-unity3d/ https://kevingulling.com/2017/01/arduino-spo2-pulse-oximeter-unity3d/#comments Tue, 17 Jan 2017 23:30:15 +0000 https://kevingulling.com/?p=1460 Arduino + SPO2 Pulse Oximeter + Unity3D After a recent hospital visit, I was given a disposable spo2 sensor to monitor my oxygen saturation and pulse which is standard practice these days. Rather than let the nurse toss my sensor afterwards, I decided to take it home and tinker with it. It would be pretty […]

The post Arduino + SPO2 Pulse Oximeter + Unity3D – Teardown Tuesday appeared first on Kevin Gulling - Game Development, VR, and more.

]]>
Arduino + SPO2 Pulse Oximeter + Unity3D

After a recent hospital visit, I was given a disposable spo2 sensor to monitor my oxygen saturation and pulse which is standard practice these days. Rather than let the nurse toss my sensor afterwards, I decided to take it home and tinker with it. It would be pretty neat to have my own spo2 monitor at home, never know when it could come in handy! I am especially interested in the applications that it can be applied to in the gaming world, such as fitness gaming, so I created a Unity asset that can handle the readings and graph the results, much like an ECG.

diy pulse oximeter

A couple of you have asked for more details about the project so here’s everything I have so far (work in progress).

I couldn’t find much on the exact sensors that Masimo uses in their resposable SP02 sensors, so disclaimer: I’m just sort of winging it here, there is definitely more info needed to perfect this project… That being said, without wasting any more time, here is the project:



Project materials:
-Arduino Uno R3
-Masimo Universal Resposable SPO2 Pulse Oximeter
-Breadboard
-10k resistor
-220 resistor
-330 resistor

SPO2 sketch:


The circuit:

breadboard schematic

This handy tool I made in Unity reads the data we send to the serial com and graphs it for us in a manner that emulates an ECG.

spo2 grapher unity3d

Download Unity3D SPO2 grapher for Windows

You’ll notice that I commented out a few lines in the sketch. Enable these lines if you would rather plot your graph using an online tool such as FooPlot rather than the realtime Unity3d made monitor.

If you have any information to contribute for the advancement of this project, leave a comment or contact me and I’ll be sure to keep this article up-to-date with new findings! If you have any questions go ahead and leave those in the comments as well and I’ll do my best to answer any.

The post Arduino + SPO2 Pulse Oximeter + Unity3D – Teardown Tuesday appeared first on Kevin Gulling - Game Development, VR, and more.

]]>
https://kevingulling.com/2017/01/arduino-spo2-pulse-oximeter-unity3d/feed/ 5 1460
12 Days of Arduino Day 12 – Glorious Spambot! – DIY Robot for $50 https://kevingulling.com/2016/12/12-days-of-arduino-day-12-glorious-spambot-robot-for-under-50/ https://kevingulling.com/2016/12/12-days-of-arduino-day-12-glorious-spambot-robot-for-under-50/#comments Sat, 24 Dec 2016 15:34:57 +0000 https://kevingulling.com/?p=1433 Day 12 of 12 Days of Arduino! On the 12th day of Arduino, I present our final project of the series: Glorious Spambot! I printed out some wheels , and fashioned some wheels out of bottle caps, and an axle out of a spray tube, a paperclip and a ballpoint pen. I found the wheel […]

The post 12 Days of Arduino Day 12 – Glorious Spambot! – DIY Robot for $50 appeared first on Kevin Gulling - Game Development, VR, and more.

]]>
spambot day12

Day 12 of 12 Days of Arduino! On the 12th day of Arduino, I present our final project of the series: Glorious Spambot! I printed out some wheels , and fashioned some wheels out of bottle caps, and an axle out of a spray tube, a paperclip and a ballpoint pen. I found the wheel model on Thingiverse. There are a ton of wheels on Thingiverse that will work great, or if you don’t have a 3d printer, I’ve found that plastic bottle caps will do the trick!

Spambot

Watch Spambot on his first official voyage:




Spambot Sketch

#include

#define rxPin 0
#define txPin 1

int motor = 3;
int fan = 5;
int incomingByte[2];
boolean motorBool = false;
boolean fanBool = false;

SoftwareSerial bluetooth(rxPin, txPin);

void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode (motor, OUTPUT);
pinMode (fan, OUTPUT);
bluetooth.begin(9600);

analogWrite (motor, 0);
analogWrite (fan, 0);
}

void loop() {
if(bluetooth.available()>0){
while(bluetooth.peek() == 'A'){
//bluetooth.println(bluetooth.peek());
bluetooth.read();
incomingByte[0] = bluetooth.parseInt();
bluetooth.println(incomingByte[0], DEC);
if(incomingByte[0] == 1){
motorBool = true;
bluetooth.print("motor:");
bluetooth.println(motorBool, DEC);
}
else if(incomingByte[0] == 0){
motorBool = false;

}
else if(incomingByte[0] == 2){
fanBool = true;
bluetooth.print("fan:");
bluetooth.println(fanBool, DEC);
}
else if(incomingByte[0] == 3){
fanBool = false;

}
}

while(bluetooth.available()>0){
bluetooth.read();
}
}

if(motorBool == true){
analogWrite (motor, 255);
//bluetooth.print("motor:");
// bluetooth.println(motorBool, DEC);
}
else{
analogWrite (motor, 0);
//bluetooth.print("motor:");
//bluetooth.println(motorBool, DEC);
}
if(fanBool == true){
analogWrite (fan, 255);
//bluetooth.print("fan:");
//bluetooth.println(fanBool, DEC);
}
else{
analogWrite (fan, 0);
//bluetooth.print("fan:");
//bluetooth.println(fanBool, DEC);
}
delay(1000);
}

The code hasn’t changed much from yesterday’s I just commented out some of the debugging stuff.

The mission of GloriousSpambot.org is simple, to create one or many useful, fully functional, open-source designs utilizing recycled and used parts and affordable components such as a Spam can, and to spread the word about it! Most robots on the market are for entertainment purposes, I want to see future iterations of Spambot that can

  • Detect Smoke/Fight Fires
  • Vacuum/Sweep/Dust
  • Monitor Pets/Children
  • Home Security
  • Elderly Care
  • Home Automation
  • Companion, Helper and Friend!
  • That might seem like quite a leap from the current iteration of Spambot, but you all saw what Spambot was 5 days ago: a pile of scraps! The possibilities are endless. By next month, the plan is to have Spambot doing tasks on the PC including making friends on social networks, and playing video games!

    That wraps up my 12 Days of Arduino series but the project will continue at www.GloriousSpamBot.org Make sure you check it out and like/subscribe for updates also follow on Twitter @GloriousSpamBot

    If you want to help out with the project, Tweet a message to @GloriousSpamBot and you will get a reply. For now it will be me, but in the near future Spambot will be in the beginning stages of automation including communicating with humans!

    Edit: it’s only been a little while since the announcement of Spambot, and already quite the following from around the world, over 1500 followers @GloriousSpamBot! Awesome! Thanks for the support everyone 😀 You can also help by clicking over to Youtube in the video above and liking/subscribing! Also thanks to @Nick Gammon for the link to the alternative TIP120 datasheet and @Due_Unto for the expert advice, @JohnLincoln for the link to transistor heatsink mounting kit

    Also to help out make sure you use this link to order components from ICStation. All proceeds will go directly back into development!


    Happy Holidays!

    The post 12 Days of Arduino Day 12 – Glorious Spambot! – DIY Robot for $50 appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]> https://kevingulling.com/2016/12/12-days-of-arduino-day-12-glorious-spambot-robot-for-under-50/feed/ 1 1433 12 Days of Arduino Day 11 – Robot Drive and Controls https://kevingulling.com/2016/12/1409/ Fri, 23 Dec 2016 20:21:39 +0000 https://kevingulling.com/?p=1409 Welcome back to Day 11 of 12 Days of Arduino! Today I backtrack a bit and tie up some “loose ends” with the design. The HC-06 that I am using states that it needs 3.3v on the rx, not 5v as I had it set up yesterday. We’ll want to comply with this to avoid […]

    The post 12 Days of Arduino Day 11 – Robot Drive and Controls appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    arduino header

    Welcome back to Day 11 of 12 Days of Arduino! Today I backtrack a bit and tie up some “loose ends” with the design.
    The HC-06 that I am using states that it needs 3.3v on the rx, not 5v as I had it set up yesterday. We’ll want to comply with this to avoid damaging any components. A simple way to go about this is to create a voltage divider using a couple resistors. I use this handy tool that does all the math for you to figure out what resistance resistors are necessary to get our voltage down to 3.3v: Voltage Divider Calculator. I ended up going with a 1k and a 2k resistor to obtain close to 3.3v.

    spambot

    Pro Tip: You won’t find this in most tutorials or datasheets, the heatsink tab of the TIP120 is directly connected to the Collector.

    Because of the heat sink I had connected to both the Tip120’s, when the circuit would close it would also close the circuit to the transistor that was also connected to the heatsink. So unfortunately I had to remove the cool looking heat sink which honestly was probably complete overkill in the first place, more aesthetic than functional, so it’s probably for the best! That being said.

    Parts:
    -Arduino Uno R3
    -Motor
    -Fan
    -Jumper Wires
    -Breadboard
    -Spam Can
    -2x TIP120 transistors
    -HC-05 or HC-06
    3d printed core
    -1k resistor
    -2k resistor



    Bluetooth Robot Controller Sketch


    Creative Commons License
    All code on this site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

    #include

    #define rxPin 0
    #define txPin 1

    int motor = 3;
    int fan = 5;
    int incomingByte[2];
    boolean motorBool = false;
    boolean fanBool = false;

    SoftwareSerial bluetooth(rxPin, txPin);

    void setup() {
    pinMode(rxPin, INPUT);
    pinMode(txPin, OUTPUT);
    pinMode (motor, OUTPUT);
    pinMode (fan, OUTPUT);
    bluetooth.begin(9600);

    analogWrite (motor, 0);
    analogWrite (fan, 0);
    }

    void loop() {
    if(bluetooth.available()>0){
    while(bluetooth.peek() == 'A'){
    //bluetooth.println(bluetooth.peek());
    bluetooth.read();
    incomingByte[0] = bluetooth.parseInt();
    bluetooth.println(incomingByte[0], DEC);
    if(incomingByte[0] == 1){
    motorBool = true;
    bluetooth.print("motor:");
    bluetooth.println(motorBool, DEC);
    }
    else if(incomingByte[0] == 0){
    motorBool = false;

    }
    else if(incomingByte[0] == 2){
    fanBool = true;
    bluetooth.print("fan:");
    bluetooth.println(fanBool, DEC);
    }
    else if(incomingByte[0] == 3){
    fanBool = false;

    }
    }

    while(bluetooth.available()>0){
    bluetooth.read();
    }
    }

    if(motorBool == true){
    analogWrite (motor, 255);
    bluetooth.print("motor:");
    bluetooth.println(motorBool, DEC);
    }
    else{
    analogWrite (motor, 0);
    bluetooth.print("motor:");
    bluetooth.println(motorBool, DEC);
    }
    if(fanBool == true){
    analogWrite (fan, 255);
    bluetooth.print("fan:");
    bluetooth.println(fanBool, DEC);
    }
    else{
    analogWrite (fan, 0);
    bluetooth.print("fan:");
    bluetooth.println(fanBool, DEC);
    }
    delay(1000);
    }

    I didn’t have time today to get as much done as I would like, so tomorrow will be a big day! That or I may have to extend it to day 13… Tomorrow I’ll put everything together and we will take Spambot for a stroll!

    Support future projects by shopping at ICStation:


    Day 12 →

    The post 12 Days of Arduino Day 11 – Robot Drive and Controls appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    1409
    12 Days of Arduino Day 10 – Robot Bluetooth Connection https://kevingulling.com/2016/12/12-days-of-arduino-day-10-robot-bluetooth-connection/ Thu, 22 Dec 2016 19:46:57 +0000 https://kevingulling.com/?p=1387 Welcome back to 12 Days of Arduino Day 10. Today we finish the core and connect to a remote computer via bluetooth. Everything has been pretty simple up until this point, so if you are a beginner you might want to watch some tutorials on YouTube and read up on the HC-05 and HC-06 before-hand. […]

    The post 12 Days of Arduino Day 10 – Robot Bluetooth Connection appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    12 days of arduino day 10

    Welcome back to 12 Days of Arduino Day 10. Today we finish the core and connect to a remote computer via bluetooth. Everything has been pretty simple up until this point, so if you are a beginner you might want to watch some tutorials on YouTube and read up on the HC-05 and HC-06 before-hand.



    Parts:
    -Arduino Uno R3
    -Motor
    -Fan
    -Jumper Wires
    -Breadboard
    -Spam Can
    -2x TIP120 transistors
    -HC-05 or HC-06

    Bluetooth Sketch

    Bluetooth Sketch

    #include <SoftwareSerial.h>

    #define rxPin 0
    #define txPin 1

    int motor = 3;
    int fan = 5;
    int incomingByte = 0;

    SoftwareSerial bluetooth(rxPin, txPin);

    void setup() {
    pinMode(rxPin, INPUT);
    pinMode(txPin, OUTPUT);
    pinMode (motor, OUTPUT);
    pinMode (fan, OUTPUT);
    bluetooth.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(bluetooth.available()>0){
    bluetooth.print("I received: ");
    bluetooth.println(incomingByte, DEC);
    }
    analogWrite (motor, 255);
    digitalWrite (fan, HIGH);
    delay(1000);
    }

    Pro Tip: If you have issues uploading your sketch, unplug the Bluetooth module from the rx/tx pins.

    Support future projects by visiting our affiliate ICStation for electronics components:


    The post 12 Days of Arduino Day 10 – Robot Bluetooth Connection appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    1387
    12 Days of Arduino Day 9 – Robot Core / Cooling System https://kevingulling.com/2016/12/12-days-arduino-day-9-robot-core-coolant-system/ Wed, 21 Dec 2016 20:31:04 +0000 https://kevingulling.com/?p=1375 Day 9 of 12 Days of Arduino! So I couldn’t wait to get our components hooked up to the core, aka the spam can so I jumped ahead of schedule a bit so we can see the robot start to take shape! Don’t worry though, there’s more to this surprise! Make sure you catch Day […]

    The post 12 Days of Arduino Day 9 – Robot Core / Cooling System appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    day9 arduino r3 robot core

    Day 9 of 12 Days of Arduino! So I couldn’t wait to get our components hooked up to the core, aka the spam can so I jumped ahead of schedule a bit so we can see the robot start to take shape! Don’t worry though, there’s more to this surprise! Make sure you catch Day 10-12, and if you’ve missed it, go back and check out the “Keyduino“.



    Parts:
    -Arduino Uno R3
    -Motor
    -Fan
    -Jumper Wires
    -Breadboard
    -Spam Can
    -2x TIP120 transistors

    2 Motors Sketch

    One motor for the driver and one for the cooling

    int motor = 3;
    int fan = 5;

    void setup () {
    pinMode (motor, OUTPUT);
    pinMode (fan, OUTPUT);
    }
    void loop () {
    analogWrite (motor, 255);
    digitalWrite (fan, HIGH);
    }

    This old fan that I scrapped off a GPU from the turn of the millennium has seen better days. It was not responding to anything less than 12v therefor I simply gave it a digitalWrite to HIGH, so I’ll likely be swapping this out in the future, and switching back to pulse width modulation. I’m not sure if there is any difference in digitalWrite() with a value of HIGH and analogWrite() with a value of 255, maybe someone can shout that out to me @KevinGulling and I’ll make an update here.

    I know a lot of you have been following along and that’s great! Show your support by giving a like or retweet, it’s highly appreciated 👍🏻 Thanks! Hope you are looking forward to tomorrow, things are starting to get fun aren’t they?

    Check out ICStation for low price electronics kits:


    The post 12 Days of Arduino Day 9 – Robot Core / Cooling System appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    1375
    12 Days of Arduino Day 8 – Simple Motor Controller https://kevingulling.com/2016/12/12-days-of-arduino/ Tue, 20 Dec 2016 21:24:19 +0000 https://kevingulling.com/?p=1356 Day 8 of 12 Days of Arduino! Today I’m starting a new project, utilizing a 6v geared motor I found on Ebay. It does 30 RPM’s after the reduction, so it should have plenty of torque for most small-scale projects! This particular motor does not have reversible polarity, so it only spins in one direction, […]

    The post 12 Days of Arduino Day 8 – Simple Motor Controller appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    day8

    Day 8 of 12 Days of Arduino! Today I’m starting a new project, utilizing a 6v geared motor I found on Ebay. It does 30 RPM’s after the reduction, so it should have plenty of torque for most small-scale projects! This particular motor does not have reversible polarity, so it only spins in one direction, but for this simple project that will due perfectly! My goal here was to create the simplest motor controller possible and my original goal was to try and find a motor that I could run directly off the Arduino Uno io pins, which is a recommended 40mA maximum load. After testing the current on the motor I purchased I found that I was drawing 70mA, which was low enough not to fry anything, but probably not going to hold up over time. But that’s fine because a Tip120 is great in this scenario!

    6v motor

    6v Geared Motor

    Project requires
    –Arduino Uno
    -Jumper wires
    Tip120 Transistor



    Using the analogWrite() method we can give the motor a value ranging from 1-255.

    sketch8

    Sketch – Simple Motor

    int motor = 3;

    void setup () {
    pinMode (motor, OUTPUT);
    }
    void loop () {
    analogWrite (motor, 255);
    }

    Tomorrow we will add a component to our circuit to control our motors output values. Edit: Changed my mind, instead I build the structure and coolant system for our new project, we will wait another day for the controls.

    Check out ICStation for a good deal Arduino Uno R3’s and a huge selection of motors:


    The post 12 Days of Arduino Day 8 – Simple Motor Controller appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    1356
    12 Days of Arduino Day 7 – Binary Beat Counter https://kevingulling.com/2016/12/1335/ https://kevingulling.com/2016/12/1335/#comments Mon, 19 Dec 2016 22:29:19 +0000 https://kevingulling.com/?p=1335 It’s day 7 of 12 Days of Arduino! On the seventh day of Arduino… We clean up the circuit for better access to controls and fill up those empty outputs on the shift register with LED’s for a true party in your pocket! Errr… Maybe that isn’t the best slogan for the Keyduino… Let’s get […]

    The post 12 Days of Arduino Day 7 – Binary Beat Counter appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    Keyduino day 7

    It’s day 7 of 12 Days of Arduino! On the seventh day of Arduino… We clean up the circuit for better access to controls and fill up those empty outputs on the shift register with LED’s for a true party in your pocket! Errr… Maybe that isn’t the best slogan for the Keyduino… Let’s get to it!

    Keyduino 0.9a

    Keyduino 0.9a

    Project requires
    –Arduino Uno
    –Active buzzer
    –3x button touch switch
    -220 ohm resistor
    -4x 10k ohm resistor
    -8x 220 ohm resistor
    -Jumper wires
    -Tip120
    -SN74HC595
    -Photoresistor
    -Potentiometer
    -7x LED



    Beat Counter Sketch

    Beat Counter Sketch


    //Pin connected to ST_CP of 74HC595
    int latchPin = 8;
    //Pin connected to SH_CP of 74HC595
    int clockPin = 12;
    ////Pin connected to DS of 74HC595
    int dataPin = 11;
    int number = 1;
    int speakerPin = 6;
    //Buttons
    int button1Pin = 2;
    int button2Pin = 3;
    int button3Pin = 4;
    int photoresistorPin = A0;
    int sensorValue = 0;
    int photoresistorSensitivity = 2;
    void setup() {
    Serial.begin(9600);
    pinMode(latchPin, OUTPUT);
    pinMode(clockPin, OUTPUT);
    pinMode(dataPin, OUTPUT);
    pinMode(speakerPin, OUTPUT);
    pinMode(button1Pin, INPUT);
    pinMode(button2Pin, INPUT);
    pinMode(button3Pin, INPUT);
    }

    void loop() {
    int potentiometerValue;
    potentiometerValue = analogRead(1);
    if(potentiometerValue < 10){ potentiometerValue = 10; } if(digitalRead(button1Pin) == HIGH){ sensorValue = analogRead(photoresistorPin); tone(speakerPin, 790 +(sensorValue*photoresistorSensitivity));//A5 digitalWrite(latchPin, LOW); // shift out the bits: shiftOut(dataPin, clockPin, MSBFIRST, number); digitalWrite(latchPin, HIGH); delay(potentiometerValue); number++; } else if(digitalRead(button2Pin) == HIGH){ sensorValue = analogRead(photoresistorPin); tone(speakerPin, 1750 +(sensorValue*photoresistorSensitivity));//A6 digitalWrite(latchPin, LOW); // shift out the bits: shiftOut(dataPin, clockPin, MSBFIRST, number); digitalWrite(latchPin, HIGH); delay(potentiometerValue); number++; } else if(digitalRead(button3Pin) == HIGH){ sensorValue = analogRead(photoresistorPin); tone(speakerPin, 3510+(sensorValue*photoresistorSensitivity));//A7 digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, MSBFIRST, number); digitalWrite(latchPin, HIGH); delay(potentiometerValue); number++; } else{ number = 0; digitalWrite(latchPin, LOW); // shift out the bits: shiftOut(dataPin, clockPin, MSBFIRST, number); digitalWrite(latchPin, HIGH); delay(10); } }

    There isn't much difference in the code today, in fact yesterdays sketch works just fine with this circuit, but I made some minor improvements to the code, opening up the ability to easily control the sensitivity of the photoresistor's pitch bending FX.

    I hope you all enjoyed the "Keyduino". I'm probably going to tear it down for parts tomorrow and get to the next project but it shall be immortalized here and on Youtube, if there is any demand, I'll model a case for it for 3d printing, so if you are a DJ or just a hobbyist and you want the Keyduino contained in a plastic shell, let me know!

    ICStation.com for an infinite supply of fun:


    The post 12 Days of Arduino Day 7 – Binary Beat Counter appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    https://kevingulling.com/2016/12/1335/feed/ 1 1335
    12 Days of Arduino – Day 4 – Tremolo FX With Shift Register https://kevingulling.com/2016/12/12-days-of-arduino-day-4-tremolo-fx-with-shift-register/ https://kevingulling.com/2016/12/12-days-of-arduino-day-4-tremolo-fx-with-shift-register/#comments Fri, 16 Dec 2016 19:31:58 +0000 https://kevingulling.com/?p=1284 Welcome back to day 4 of 12 days of Arduino! I’m glad you’ve been following this far, things are about to get exciting! Today I take the keyboard and using a SN74HC595 Texas Instruments Shift Register I create a tremolo effect Project requires –Arduino Uno –Active buzzer –3x button touch switch -220 ohm resistor -3x […]

    The post 12 Days of Arduino – Day 4 – Tremolo FX With Shift Register appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    shift register tremolo

    Welcome back to day 4 of 12 days of Arduino! I’m glad you’ve been following this far, things are about to get exciting! Today I take the keyboard and using a SN74HC595 Texas Instruments Shift Register I create a tremolo effect



    Project requires
    –Arduino Uno
    –Active buzzer
    –3x button touch switch
    -220 ohm resistor
    -3x 10k ohm resistor
    -220 ohm resistor
    -Jumper wires
    -Tip120
    -SN74HC595

    SN74HC595 Shift Register datasheet.
    Tip 120 datasheet from adafruit.

    arduino keyboard with tremelo

    Keyboard with Tremolo Sketch


    //Pin connected to ST_CP of 74HC595
    int latchPin = 8;
    //Pin connected to SH_CP of 74HC595
    int clockPin = 12;
    ////Pin connected to DS of 74HC595
    int dataPin = 11;

    int number = 1;
    int speakerPin = 6;

    //Buttons
    int button1Pin = 2;
    int button2Pin = 3;
    int button3Pin = 4;

    void setup() {
    pinMode(latchPin, OUTPUT);
    pinMode(clockPin, OUTPUT);
    pinMode(dataPin, OUTPUT);
    pinMode(speakerPin, OUTPUT);
    pinMode(button1Pin, INPUT);
    pinMode(button2Pin, INPUT);
    pinMode(button3Pin, INPUT);

    }

    void loop() {
    if(digitalRead(button1Pin) == HIGH){
    tone(speakerPin, 1000);
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, number);
    digitalWrite(latchPin, HIGH);
    delay(10);
    number++;
    }
    else if(digitalRead(button2Pin) == HIGH){
    tone(speakerPin, 2000);
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, number);
    digitalWrite(latchPin, HIGH);
    delay(10);
    number++;
    }
    else if(digitalRead(button3Pin) == HIGH){
    tone(speakerPin, 3000);
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, number);
    digitalWrite(latchPin, HIGH);
    delay(10);
    number++;
    }
    else{
    number = 0;
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, number);
    digitalWrite(latchPin, HIGH);
    delay(10);
    }

    }

    One thing to note here is that MSBFIRST means “most significant bit first” and LSBFIRST means “least significant bit first”. We want to use MSBFIRST to accomplish this effect. Basically what’s happening here is we increment 0 by 1 each time the loop is ran and as a result we have an alternating effect on pin 1 of the shift register. A cleaner way to run this would be to increment by 1 and then subtract by 1, but really this is all pointless in the first place, it’s definitely a “Rube Goldberg” way of going about this since you could simply program it with code, but there are opportunities here to utilize 7 more pins, so maybe tomorrow I can make this into something “practical” (I use this term loosely!) and utilize more of the 8 bits of memory we can store here! The possibilities are endless, exciting!

    Here’s a tutorial for ShiftOut I highly recommend if you are getting started with shift registers!

    Please check out the sponsor of this series:


    The post 12 Days of Arduino – Day 4 – Tremolo FX With Shift Register appeared first on Kevin Gulling - Game Development, VR, and more.

    ]]>
    https://kevingulling.com/2016/12/12-days-of-arduino-day-4-tremolo-fx-with-shift-register/feed/ 1 1284