Difference between revisions of "Sensor-Joystick"

From Microduino Wiki
Jump to: navigation, search
m (Fengfeng moved page Microduino-Joystick to Sensor-Joystick)
(Introduction of Sensor Pin)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Language|Microduino-Joystick }}
+
{{Language|Sensor-Joystick }}
 
{| style="width: 800px;"
 
{| style="width: 800px;"
 
|-
 
|-
 
|
 
|
[[File: Microduino-Joystick.jpg|400px|thumb|right| Microduino-Joystick]]
+
[[File:Microduino-Joystick-v1.jpg|400px|thumb|right| Microduino-Joystick]]
  
Microduino-Joystick is a joystick sensor, which can detect horizontal displacement of a joystick.
+
The product number of Sensor-Joystick is: '''MSDS71'''
It can return analog values of X-axis and Y-axis via the analog port, whose range is between 0-1,023.
 
  
 +
Sensor-Joystick is analog sensor, which is used as five-direction rocker button.
  
 +
==Introduction of Sensor Pin==
 +
{{ST_Pinout
 +
|st_name=Joystick
 +
|pin3=Analog Input
 +
}}
  
 +
==Features==
 +
*With small size which is easy to install.
 +
*Five-direction stick button, only occupying 1 analog port.
  
==Features==
+
==Specification==
*With X- and Y-axis directions.
+
*Sensor voltage
*Small and beautiful 
+
**3.3V~5V working voltage
  
==Specification ==
+
*Size of the sensor
*Electrical specification
+
**Size of the board: 23.5mm*13mm
**Operation voltage: 3.3V~5V
+
**1.27mm-spacing 4Pin interface connected with sensorhub
**Input device
+
**CAD drawing of the sensor: '''[[File:Sensor_CAD.zip]]'''
*Tech parameters
 
**Pin description: GND, VCC, signal 1 output and signal 2 output. Since the output signal is simulated, you can use analog port to detect (A0-A7) by connecting to the pins including A7/A6,A3/A2 and A1/A0 of Sensorhub.
 
**Analog input
 
*Size
 
**Size of the switch: 17mm*17mm,
 
**Size of the board: 20mm*24mm
 
**1.27mm-pitch 4Pin interface connects with Sensorhub.  
 
  
[[file:mCookie-sensorhub_rule.JPG|thumb|800px|center]]
+
*Function description
[[File: Microduino-Joystick_rule1.jpg|600px|thumb|center]]
+
**It can detect the direction up, down, left, right and being pressed of the stick button.  
 +
*Connection
 +
**This sensor can be connected to the following interfaces of the core: '''A0~A7'''
  
 
==Document==
 
==Document==
  
*Schematic: '''[[File: Microduino_ Joystick.Zip]]'''
+
*Schematic diagram: '''[[File: Sensor_Joystick.pdf]]'''
 
+
*Main sensor: '''[[File: SKRHABE010-datasheet.pdf]]'''
  
 
==Development==
 
==Development==
===Preparation===
+
===Program Download===
*Make sure you build Microduino IDE or refer to: [[Microduino Getting started]]
+
*Download and unzip the program '''[[File: Sensor_Joystick_Test.zip]]'''
*Core selection
 
**1. Adopt [[Microduino-CoreUSB]] or [[mCookie-CoreUSB]] as the core.
 
**2. Adopt [[Microduino-Core]] or [[Microduino-Core+]] as the core plus [[Microduino-USBTTL]] as the program download module.
 
  
 +
===Programming===
 +
{{Upload
 +
|nameA=[[Microduino-Core]], [[Microduino-USBTTL]]
 +
|nameB=[[Microduino-USBTTL]]
 +
|boardName=Microduino/mCookie-Core(328p), Atmega328P@16M,5V
 +
|fileName=Sensor_Joystick_Test.ino
 +
}}
  
===Program===
+
===Hardware Setup===
<source lang="cpp">
+
*Referring to the following diagram, connect the Sensor-Joystick to the analog port A0/A1 of '''[[Microduino-Sensorhub]]'''.
 +
<br>
 +
[[file:Microduino-sensorhub_Joystick.JPG|thumb|400px|left]]
 +
<br style="clear: left"/>
  
void setup() {
+
===Result===
  Serial.begin(9600);    //Serial port initializing
+
*After download, open the serial monitor.
}
+
**When press the stick toward different direction, the serial port will print out different contents.
  
void loop() {
 
  int sensorValueX = analogRead(A0);      //X-axis input
 
  int sensorValueY = analogRead(A1);      //Y-axis input
 
  float voltageX = sensorValueX * (5.0 / 1023.0);
 
  float voltageY = sensorValueY * (5.0 / 1023.0);
 
  Serial.print(voltageX);
 
  Serial.print(",");
 
  Serial.println(voltageY);
 
  delay(50);
 
}
 
}
 
</source>
 
 
===Hardware Buildup===
 
*Stack all modules firstly, then connect Microduino-Joystick with Sensorhub to A0/A1 port with a wire. 
 
Please refer to: [[Microduino-Sensorhub]]
 
[[file:Microduino-sensorhub_Analog.PNG|thumb|400px|center]]
 
Please refer to: [[mCookie-Hub]]
 
[[file:mCookie-sensorhub_Analog.PNG|thumb|400px|center]]
 
*Connect the core, Sensorhub and LED to a computer with a USB cable.
 
*Select the right board and COM port, compile and download. You can refer to [[AVR Core:Getting started]]
 
[[file:upload.JPG|thumb|800px|center]]
 
*Choose the right port number from Tools→Serial Port in Arduino IDE after compiling and then download program. 
 
*Open the serial monitor after download and you'll see analog quantities on the direction of X-axis and Y-axis displayed on the console. When the joystick is in the middle, it displays around 2.5 on both X-axis and Y-axis. 
 
 
==Application==
 
==Application==
You can simulate mouse movement and other displacement sensors as human-computer interaction input.
+
*Rocker button input device
  
===Project===
+
==Project==
* '''[[The Use of Joystick Sensor]]'''
 
 
 
==Purchase==
 
  
 
==History==
 
==History==
  
==Pictures==
+
==Gallery==
 
+
{| border="0" cellpadding="10" width="100%"
*Front
+
|-
[[file: Microduino-Joystick-F.JPG|thumb|600px|center|Microduino-Joystick Front]]
+
|width="50%" valign="top" align="left"|
*Back
+
[[file: Microduino-Joystick-F.JPG|thumb|480px|center|mCookie-Joystick Front]]
[[file: Microduino-Joystick -b.JPG|thumb|600px|center|Microduino-Joystick Back]]
+
|width="50%" valign="top" align="left"|
 +
[[file: Microduino-Joystick-b.JPG|thumb|480px|center|mCookie-Joystick Back]]
 +
|}
 
|}
 
|}

Latest revision as of 22:50, 30 March 2017

Language: English  • 中文
Microduino-Joystick

The product number of Sensor-Joystick is: MSDS71

Sensor-Joystick is analog sensor, which is used as five-direction rocker button.

Introduction of Sensor Pin

Sensor backpin.png

Joystick
General Pin Out Sensor / Trinket's Pin Out
PIN1 (GND) GND
PIN2 (VCC) VCC
PIN3 (SIGNAL-A) Analog Input
PIN4 (SIGNAL-B) Not Connected
  • General Pin Out is the standard pin out of a Sensor / Trinket connector.
  • Sensor / Trinket's Pin Out is this specific Sensor / Trinket's wiring in relation to the General Pin Out.
  • SIGNAL-A / SIGNAL-B are signals that could be digital input, digital output, analog input or analog output. Or special signals such as serial communication (SoftwareSerial, IIC (I2C), etc) or other special signals.
  • Not Connected refers to the Pin not being used for this particular Sensor / Trinket.
  • Read more about the hub module.

Features

  • With small size which is easy to install.
  • Five-direction stick button, only occupying 1 analog port.

Specification

  • Sensor voltage
    • 3.3V~5V working voltage
  • Size of the sensor
    • Size of the board: 23.5mm*13mm
    • 1.27mm-spacing 4Pin interface connected with sensorhub
    • CAD drawing of the sensor: File:Sensor CAD.zip
  • Function description
    • It can detect the direction up, down, left, right and being pressed of the stick button.
  • Connection
    • This sensor can be connected to the following interfaces of the core: A0~A7

Document

Development

Program Download

Programming

  • Follow the Software Getting Started Guide.
  • Select the Board, Processor and Port.
  • Click [File]->[Open], browse to the project program address, and click "Sensor_Joystick_Test.ino" to open the program.
  • After confirming all these items are correct, click "→" to download the program to the development board.

Hardware Setup

  • Referring to the following diagram, connect the Sensor-Joystick to the analog port A0/A1 of Microduino-Sensorhub.


Microduino-sensorhub Joystick.JPG


Result

  • After download, open the serial monitor.
    • When press the stick toward different direction, the serial port will print out different contents.

Application

  • Rocker button input device

Project

History

Gallery

File:Microduino-Joystick-F.JPG
mCookie-Joystick Front
File:Microduino-Joystick-b.JPG
mCookie-Joystick Back
Retrieved from "https://wiki.microduinoinc.com/index.php?title=Sensor-Joystick&oldid=12669"