Prextron CHAIN BLOCKS - Arduino Nano controlled Ultrasonic sensor that switches a motor wirelessly using 433MHz RF modules and a relay board. Reviewed by Unknown on 09:01 Rating: 4.5

Prextron CHAIN BLOCKS - Arduino Nano controlled Ultrasonic sensor that switches a motor wirelessly using 433MHz RF modules and a relay board.


 

Description

In this tutorial, I will be evaluating Prextron CHAIN blocks – a new system that allows you to connect your sensors and actuators to an Arduino NANO using clever 3D-printed prototyping boards that can be stacked sideways. This very modular system makes it easy to connect, disconnect and replace project components, and eliminate the “rats nest of wires” common to many advanced Arduino projects. CHAIN BLOCKS are open, which means that you can incorporate any of your sensors or actuators to these prototyping boards, and you can decide which specific pin on Arduino you plan to use. The CHAIN BLOCK connections prevent or reduce common connection mistakes, which make them ideal for class-room projects and learning activities.

I am going to set up a project to put these CHAIN BLOCKs to the test:
When I place my hand in-front of an Ultrasonic sensor, the Arduino will transmit a signal wirelessly to another Arduino, and consequently turn on a motor.


 

Parts Required:

You need the following Prextron Chain Blocks


Please note: You may need to solder the module wires to the CHAIN BLOCK protoboard.


 
 

Arduino Libraries and IDE

This project does not use any libraries. However, you will need to upload Arduino code to the Arduino. For this you will need the Arduino IDE which can be obtained from the official Arduino website:
https://www.arduino.cc/en/main/software


 
 

ARDUINO CODE: RF Transmitter

/* ===============================================================
Project: CHAIN BLOCKS : HC-SR04 433MHz RF Transmitter sketch
Author: Scott C
Created: 26th Feb 2017
Arduino IDE: 1.8.1
Website: http://arduinobasics.blogspot.com.au
Description: Use a HC-SR04 ultrasonic sensor to trigger a signal to be sent via
a 433Mhz RF transmitter.
================================================================== */
#define trig 3 //Connect Arduino Digital Pin3 to the Trig pin on the HC-SR04 sensor
#define echo 4 //Connect Arduino Digital Pin4 to the Echo pin on the HC-SR04 sensor
#define rfTransmit 5 //Connect Arduino Digital Pin5 to the data pin on the 433MHz RF transmitter
#define red 6 //Connect Arduino Digital Pin6 to the RED LED.
#define green 9 //Connect Arduino Digital Pin9 to the GREEN LED.
float TempC = 24.0; //Current Temperature will affect speed of sound.
float speedOfSound;
long duration, distance; //Duration will used to calculate the distance
boolean activated = false; //If distance is less than 30cm, the "activated" variable will be TRUE.
void setup() {
// put your setup code here, to run once:
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(rfTransmit, OUTPUT);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
}
void loop() {
activated = checkDistance(); //If distance is less than 30cm, the "activated" variable will be TRUE.
if(activated){
digitalWrite(red,LOW); //Turn off the RED LED
digitalWrite(green, HIGH); //Turn on the GREEN LED
analogWrite(rfTransmit, 150); //Transmit a signal with a duty cycle of 150/255 via the 433Mhz transmitter
}else {
digitalWrite(green,LOW); //Turn off the GREEN LED
digitalWrite(red, HIGH); //Turn on the RED LED
analogWrite(rfTransmit, 100); //Transmit a signal with a duty cycle of 100/255 via the 433Mhz transmitter
}
delay(100);
}
/* =====================================================================
* checkDistance()
* is a function that takes a reading from the HCSR04 ultrasonic sensor to determine the distance of an object to the sensor.
* When the sensor detects an object within 30cm, it will return TRUE.
* Otherwise it will return FALSE.
* =====================================================================
*/
boolean checkDistance(){
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
speedOfSound = (331.3 + (0.6*TempC)) / 10000.0; //Speed of sound in "cm per microsecond"
distance = (duration*speedOfSound)/2; //Calculate the distance (in cm) based on the speed of sound.
if(distance<30){ //When the distance detected is <30cm, it will return TRUE
return true;
}
return false;
}


 
 

ARDUINO CODE: RF Receiver

/* ===============================================================
Project: CHAIN BLOCKS : 433MHz Receiver with Relay and Motor
Author: Scott C
Created: 26th Feb 2017
Arduino IDE: 1.8.1
Website: http://arduinobasics.blogspot.com.au
Description: Use the 433Mhz RF receiver to receive a signal. The Arduino
will process this signal and will trigger a relay
based on the result of the signal. A motor is attached to the
relay for extra effect.
================================================================== */
#define relay 10 //Connect relay module signal pin to Arduino digital pin 10
long mySignal=0; //This variable holds the signal value
int reps = 200; //Increase the number of repetitions (Reps) for greater accuracy
boolean trigger = false; //The relay will switch when the "trigger" is true
boolean lastTrigger = false; //Hold the state of the last Trigger value
int threshold = 325; //If mySignal is greater than this threshold, it will trigger the relay
/* ================================================================
* SETUP ()
================================================================== */
void setup() {
pinMode(relay, OUTPUT);
Serial.begin(9600);
}
/* ================================================================
* LOOP ()
================================================================== */
void loop() {
mySignal = 0; //Reset this variable with every loop.
for(int i=0; i<reps; i++){
mySignal = mySignal + analogRead(A0);
}
mySignal = mySignal / reps; //Take the average analog reading.
Serial.println(mySignal); //Print to the serial monitor / or plotter.
if(mySignal>threshold){ //If mySignal is greater than the threshold, it will trigger the relay
trigger = true;
} else {
trigger = false;
}
if(trigger==lastTrigger){
//do nothing if the current trigger is the same as the last trigger.
}else {
digitalWrite(relay, trigger); //The state of the relay will reflect that of the trigger value
delay(200); //The 200ms delay is necessary for stability reasons, DO NOT DELETE
lastTrigger=trigger; //Keep track of the state of the current trigger.
}
}


 
 

Fritzing diagrams for Transmitter


 


 


 


 

 

Fritzing diagrams for Receiver


 


 


 


 

Concluding comments

The purpose of this project was to evaluate Prextron CHAIN BLOCKs and put them to the test. Here is what I thought of CHAIN BLOCKS at the time of evaluation. Some of my points mentioned below may no longer apply to the current product. It may have evolved / improved since then. So please take that into consideration


 

What I liked about Chain Blocks

  • The design is simple, the product is simple.
  • Once the Chain Blocks were all assembled, they were very easy to connect to each other.
  • I can really see the benefit of Chain Blocks in a teaching environment, because it simplifies the connection process, and reduces connection mixups.
  • It was good to see that the blocks come in different colours, which means that you can set up different colour schemes for different types of modules.
  • You can incorporate pretty much any sensor or Actuator into the Chain block which is very appealing.
  • You also have the flexibility of choosing which pins you plan to use on the Arduino.
  • Projects look a lot neater, because you no longer have the rats nest of wires.
  • The Blocks lock into each other which means that they are much easier to transport/carry.


 

What I did not like about Chain Blocks

  • In most cases, the Chain Block protoboard lanes were not numbered, which increased the chances of making mistakes when soldering
  • The need to solder modules to the protoboard, may be a discouragement for some people.
  • I would have liked a choice of different size Chain blocks. Some of the sensors did not fit nicely into the Square blocks.
  • Prextron really need to work on their website if they plan to get serious with this product: Webpage has incomplete functionality or irrelevant links etc etc.


 
 
 

Thank you very much to Prextron for providing the CHAIN BLOCKS used in this tutorial, and allowing me to try out their product. If you are interested in trying them yourself, then make sure to visit them at:


 
 
 
 
 
If you like this page, please do me a favour and show your appreciation :

 
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
I can also be found on Pinterest and Instagram.
Have a look at my videos on my YouTube channel.

Description: Prextron CHAIN BLOCKS - Arduino Nano controlled Ultrasonic sensor that switches a motor wirelessly using 433MHz RF modules and a relay board. Rating: 3.5 Reviewer: Unknown ItemReviewed: Prextron CHAIN BLOCKS - Arduino Nano controlled Ultrasonic sensor that switches a motor wirelessly using 433MHz RF modules and a relay board.

writed by : Unknown

Ikmalil birri you are reading post about Prextron CHAIN BLOCKS - Arduino Nano controlled Ultrasonic sensor that switches a motor wirelessly using 433MHz RF modules and a relay board. which writed by malikmal with about : and sorry, you haven't permittion to copy paste this post and upload back my file !.

If you like the article on this blog, please subscribe free via email, that way you will get a shipment every article there is an article that appeared in malikmal

0 comments:

Post a Comment

Back to top