Showing posts with label Addicore. Show all posts
Showing posts with label Addicore. Show all posts

Tuesday, June 16, 2015

Vibration Sensors SW-18015P and SW-18020P

There is a post on how to use these simple vibration sensors with a LaunchPad here on github.  They act like open switches that close momentarily when shaken or bumped.  I got mine at Addicore.

Saturday, June 13, 2015

Addicore 20 x 4 Serial LCD using I2C and Addicore Bi-Directional Level Converter

This post uses the same Addicore 20x4 Serial LCD that I used in this post.  However, this time I used an Addicore Level Converter instead of creating a circuit.  The Level Converter is easy to use, reasonably priced, and has 4 channels should you need them.  I've also posted an I2C library with it that was obtained from the DFRobot.com site.  The library, example code, and circuit are located here on github.  The example demonstrates how to define special characters and also simple animation.



 I tested the sketch with the F5529, CC3200, and the MSP432P410R.  It should work with a 2 line LCD as well but I haven't tried that since I don't have one with I2C.


Friday, June 5, 2015

HC-SR04 Ultrasonic Distance Sensor

Here's a simple sketch that shows how to use the HC-SR04 ultrasonic distance sensor.  I bought this one from Addicore.  They are inexpensive and work well for what they are, especially for the cost.  They are easy to get going and fun to play with.  The code is here on Github.

Here it is, measuring the distance from my laptop to the wall...

Tuesday, June 2, 2015

CNY70 Tachometer

Here are some photographs of a CNY70 Reflective Optical Sensor mounted on a little board for use as a tachometer.

 In the photograph below the reflector can be seen.  It is simply a piece of white paper glued to the fan rotor.
 Here it is with the MSP-EXP430F5529 spitting out RPM values to the serial monitor.  I've turned the fan off and it is slowing down.


The code and schematic can be found here on Github.  It includes a discussion of how the sensor works and modifying it to work on an Arduino Uno.

Thursday, May 21, 2015

Addicore Joystick with Push Button

Here is a nice little joystick from Addicore with push button action.  It's easy to use on the MSP430F5529LP.  It uses dual potentiometers for the x and y axis.  Note that there is a commented out line that you can use if desired to change the numeric value for the y axis so that zero voltage is down instead of up.  The x axis goes from zero at left to 4095 at right.  The F5529 has analog resolution of 4096 - you will need to change this to 1023 for Arduino or lower resolution MSP430s.



The Energia sketch below demonstrates how it works.

 /*
 Read Joystick and Push Button - display to Serial Monitor
 Tested with MSP540F5529LP
 Addicore joystick with push button
 https://www.addicore.com/Dual-Axis-XY-Joystick-Module-with-Push-Button-p/139.htm

 F. Milburn 5/19/2015

 Joystick  MSP430F5529LP
 --------  -------------
 GND       GND
 +5V       3V3
 VRX       P6.0
 VRY       P6.1
 SW        P3.4

 */

 int xPin = P6_0;           // x direction potentiometer pin
 int yPin = P6_1;           // y direction potentiometer pin
 int pushPin = P3_4;        // Push button pin
 int xValue = 0;            // x direction potentiometer value (0 to 4095)
 int yValue = 0;            // y direction potentiometer value (0 to 4095)
 int pushState = 0;         // Push button state (0 or 1)

 void setup()
 {
   Serial.begin(9600);
   Serial.println("Starting...");
   pinMode(pushPin, INPUT_PULLUP);
 }

 void loop()
 {
   // Read joystick position
   xValue = analogRead(xPin);         // Read x     (x0 left)
   yValue = analogRead(yPin);         // Read y     (y0 top)
   // yValue = abs(4095 - yValue);    // Reverse y direction  
  
   Serial.print("X = ");
   Serial.print(xValue);
   Serial.print("   ");
   Serial.print("Y = ");
   Serial.print(yValue);
   Serial.print("   ");
  
   // Read button status
   pushState = digitalRead(pushPin);  // See if joystick has been pushed in
  
   Serial.print("Joystick is ");
   if (pushState == 0)
   {
     Serial.println("pushed in");
   }
   else
   {
     Serial.println("not pushed");
   }
  
   delay(200); 
 }

Addicore 20 x 4 Serial LCD using I2C and BS170 MOSFETs

This is a very nice 20 column, 4 line display from Addicore - big and easy to read.  I've ordered several things from them recently and have been pleased.  They have free mailing in the U.S. for orders over $25 and are quick and responsive.  Recommended....

Here is what it looks like when up and running on the MSP430F5529 LaunchPad.



Note that this is a 5V device!  I've translated signals using BS170 MOSFETs and the following circuit.



I got it up and running easily using a library from DFRobot.

Here is the test code running in the display above.

//Using library from DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
/*
 * 20x4 Serial LCD from Addicore
 * https://www.addicore.com/2004-20x4-Character-LCD-with-I2C-backpack-p/157.htm
 * Tested on MSP430F5529LP
 * NOTE: This is a 5V device!
 * Need to translate 3V3 <---> 5V (used two BS170 MOSFETs)
 * F Milburn   21 May 2015
*/
#include <Wire.h>
#include "LiquidCrystal_I2C.h"

LiquidCrystal_I2C lcd(0x27,20,4);  // set for a 20 character 4 line display

void setup()
{
  lcd.init();                      // initialize the lcd
  // LINE 0
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("First line");
}

void loop()
{
  // LINE 1 - Number of columns
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  lcd.print("Second line");
 
  // LINE 2 - ENERGIA
  lcd.setCursor(0, 2);
  lcd.print("Third line");
 
  // LINE 3 - Count seconds
  lcd.setCursor(0, 3);
  lcd.print("Time since reset:");
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

Wednesday, March 11, 2015

Sites I Frequent

These are sites I frequently visit and can recommend.  Here they are, in the order I more or less discovered them:

Arduino:  The educational / hobbyist / maker movement has benefited greatly from Arduino.  There is a lot of good stuff on their site and the internet is full of good (and not so good) support.  This is a very good place to start if you are new to microcontrollers (but this is a blog about the TI LaunchPad series so let's move on)

SparkFun:  I got started in microcontrollers with a "SparkFun  Inventor's Kit" and SparkFun RedBoard (an Arduino Uno compatible).  They have a large selection of hobbyist material and documentation for their products.

Adafruit:  Great products.  Great documentation.  Great service.  This is a really good place to go for Arduino, Raspberry Pi, and Beaglebone Black.  Many of their products can also be used with the Texas Instrument Launchpads.

Texas Instruments:  The Texas Instrument LaunchPad lineup offers incredible value and capability.  Read more about them here.

Energia:  Energia is a fork of Wiring and Arduino for various Texas Instruments LaunchPads - if you have some experience with the Arduino, this site is going to look familiar.  And the great thing is that moving to Code Composer Studio, TI's full featured development environment, is available if you need the additional capability.

Mouser:  I love these guys.  If you need one 10 cent resistor they will ship it to you.  And they carry an amazing array of products, all with datasheets - including the TI LaunchPad series.

Pololu:  I recently started using Pololu for robot components and have been pleased.  They have some interesting products with good range - especially in motors and motor controllers.

Addicore:  They don't have as large a selection as the companies above but what they do have is great value (free shipping on orders larger than $25 too!).  They are very quick and responsive - the best service I have received.  You will also find some of their items on Amazon (at a slightly higher price).