Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is not supported at present. Please extend your EasyEDA usage duration and try again.
Editor Version×
Standard
1.Easy to use and quick to get started
2.The process supports design scales of 300 devices or 1000 pads
3.Supports simple circuit simulation
4.For students, teachers, creators
Profession
1.Brand new interactions and interfaces
2.Smooth support for design sizes of over 5,000 devices or 10,000 pads
3.More rigorous design constraints, more standardized processes
Grove - Collision Sensor
------------------------
![enter image description here][1]
Have you ever been bothered for detecting simple collisions with complex algorithm with an acceleration sensor? The collision sensor is here to simplify the process,.
It's also omni directional, stable, and sensitive.
Features
Wide power supply range DC3.3V to 5V
Grove module
High sensitive
RoHS/WEEE lead-free compliant
For more detail, please visit: http://www.seeedstudio.com/item_detail.html?p_id=1132
Demonstration
-------------
With Arduino
------------
Based on the output signal will change when a collision happens, we design this demo: each time the sensor detects collision, the LED will light up. Here the LED is as a managed device, and you can refer to the demo to control your device, such as bicycle light.
The procedure is as follows:
1. Connect the collision sensor to the Digital port 2 of Grove - Basic Shield using a Grove cable and connect an LED to Pin 13.
2. Plug the Grove - Basic Shield into Arduino.
3. Connect Arduino/Seeeduino to PC by using a USB cable.
4. Copy and paste code below to a new Arduino sketch. And upload it to your Arduino.
/****************************************************************************/
// Function: Monitor if there is any collision
// Hardware: Grove - Collision Sensor
// Arduino IDE: Arduino-1.0
// by www.seeedstudio.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
/*******************************************************************************/
#define LED 13 //the onboard LED of Arduino or Seeeduino
#define COLLISION_SENSOR 2//collision sensor is connected with D2 of Arduino
void setup()
{
pins_init();
}
void loop()
{
if(isTriggered())
{
turnOnLED();
delay(2000);
}
else turnOffLED();
}
void pins_init()
{
pinMode(LED,OUTPUT);
turnOffLED();
pinMode(COLLISION_SENSOR,INPUT);
}
boolean isTriggered()
{
if(!digitalRead(COLLISION_SENSOR))
{
delay(50);
if(!digitalRead(COLLISION_SENSOR))
return true;//the collision sensor triggers
}
return false;
}
void turnOnLED()
{
digitalWrite(LED,HIGH);//the LED is on
}
void turnOffLED()
{
digitalWrite(LED,LOW);//the LED is off
}
5. Now you can check the status of LED. The LED should light up every time you drum fingers on the table.
You can adjust the sensor sensitivity by changing the function delay(50) in code.
if(!digitalRead(COLLISION_SENSOR))
{
return true;//the collision sensor triggers
}
return false;
With Raspberry Pi
-----------------
1.You should have got a raspberry pi and a grovepi or grovepi+.
2.You should have completed configuring the development enviroment, otherwise follow here.
3.Connection
Plug the sensor to grovepi socket D2 by using a grove cable.
4.Navigate to the demos' directory:
cd yourpath/GrovePi/Software/Python/
To see the code
nano grove_collision_sensor.py # "Ctrl+x" to exit #
import time
import grovepi
# Connect the Grove Collision Sensor to digital port D2
# SIG,NC,VCC,GND
collision_sensor = 2
grovepi.pinMode(collision_sensor,"INPUT")
while True:
try:
print grovepi.digitalRead(collision_sensor)
time.sleep(.5)
except IOError:
print "Error"
5.Run the demo.
sudo python grove_collision_sensor.py
[1]: http://www.seeedstudio.com/wiki/images/thumb/6/66/Grove_%E2%80%93_Collision_Sensor_photo.jpg/400px-Grove_%E2%80%93_Collision_Sensor_photo.jpg
Forked project will be set private in personal workspace. Do you continue?
Clone
Project
The Pro editor is about to be opened to save as. Do you want to continue?
private message
Send message to daniel_kim
Delete
Comment
Are you sure to delete the comment?
Report
Grove - Collision Sensor copy
No Profile
Announcer: Daniel_kim
Creation time: 2018-08-04 11:22:45
Published time:
2018-08-04 11:22:48
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
Submitted successfully! The review result can be viewed in the personal
center, review notification.
Kind tips
Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is
not supported at present. Please extend your EasyEDA usage duration and try again.
Share
Project
Copy
Copy
Scan the QR code and open it on the mobile terminal