Coding Book V2 V2.1
Coding Book V2 V2.1
Version 2.1
Cretile is designed in such a manner that Cretiles can be connected to each other only
in the right manner, avoiding possibility of wrong connection. When Cretile are
connected they hold each other strongly. This avoids troubles that could arise because
of loose connections.
Below image shows how three Cretiles can be easily connected to each other to make
a circuit.
Cretile offers a large number of blocks that perform different function. This allows you to
mix different functions and build incredibly large number of combinations and projects.
3) While disconnecting two Cretiles do not pull Cretiles forcefully from each other. Firmly
hold one of the Cretiles and softly pull second Cretile out while moving it little up and
down.
5) Do not touch Cretile circuit part when Cretile circuit is switched ON. Make sure that
Cretiles do not come in contact with any liquid or metal. There are two exceptions to
this: submersible pump must be put in water and connectivity Sensor can touch metal
parts or liquids.
Input Output
When Cretiles are connected to each other, a Cretile block receives ON or OFF signal at
its input. It then uses that input and changes it as required and provides output signal at its
Output pins. The next connected Cretile receives this output signal from previous Cretile at
input pins.
Let’s build our first circuit: Connect Battery/Power, Switch & Light as shown below.
STEP 1: Once connected, switch Battery/Power ON. Initially keep the Switch in OFF position.
See below diagram to understand ON or OFF signals that are exchanged between
Cretiles.
STEP 2: In the second step, put the Switch in ON position. Now see below diagram to learn
how signals that are exchanged between Cretiles changes.
Step 2: Switch it ON
ON ON ON ON ON
Zero is equivalent to OFF while 99 is equivalent to ON. Let’s relook at our circuit with this
new understanding.
99 99 0 0 Light
is OFF
Step 2: Switch it ON
99 99 99 99 Light
Switches
ON
Cretile Dimmer is similar to fan speed regulators. It provides different levels of output to the
Cretile connected to it.
As said before, Cretiles exchanges different values from 0 to 99 at its output. Values at
inputs and output for different Cretiles can be visualized as below.
99 99 40 40 Light glows
at 40%
Brightness
In above setup, as Battery is switched ON, Dimmer receives value ‘99’ at its input. This
enables the Dimmer. As the Dimmer knob is set at ‘40’, it provides ‘40’ at its output which
is received by Light at its input. As Light receives ‘40’ at its input the Light glows at 40%
brightness.
Now set the Dimmer knob to 60 and observe the changes that happen.
99 99 60 60 Light glows at
60%
Now, let’s add a Switch before the Dimmer as shown below: Brightness
99 99 0 0 0 0 Light is
OFF
As the Switch is in OFF position, Dimmer receives zero at its input and hence Dimmer is
disabled. Hence, irrespective of Dimmer knob position Dimmer will give zero at its output.
Now operate the Switch to ON position and observe the change as shown below. As you
put Switch in ON position, its output becomes ‘99’. This enables the Dimmer. As the Dimmer
knob is at ‘40’ Dimmer provide ‘40’ at its output. This is given as input to Light and hence
Light glows at 40% brightness.
Switch it ON Switch it ON
Light is ON
99 99 99 99 40 40
40%
Brightness
The mode switch decides if power is taken from battery or adapter. A DC adapter can be
connected to Battery/Power as shown below.
Step 3: Now, push the battery from the back side as shown below.
Step 4: Finally press the battery from the top so that it fits in the holder.
Step 5: We are done with fixing the battery to the battery holder. Now, switch on the power
button.
LED glows
when
Cretile Push-button is similar to switch used in door switched
bell. It has one input and one output. It is by default ON
OFF. Cretile Push Button remains ON for the
duration the push button is pressed. Once the push
button is released, it switches OFF.
Make & learn: Connect Battery + Dimmer + Light in sequence & power-on the assembly. You can
vary the intensity of the Light by operating the dimmer knob. Similarly, speed of Cretile Motor, sound
of Cretile Buzzer etc. can also be controlled using Dimmer.
ON ON ON ON Light glows
Value = 40 Value = 40 at 40%
brightness
Sensor connected generates ON or OFF signal depending on its functionality e.g. a Sound
Senor gemerates ON output when sound is detected. Sensor Base with Threshold makes
sensor singal available at it’s output.
Make & learn: Connect Battery + Switch + Sensor Base with Threshold (with Light Sensor mounted
on it) + Buzzer in sequence & power-on the assembly. Switch ON Battery and put the Switch in ON
position. Use a flash-light/torch and focus light on Light Sensor. You will observe that the Buzzer will
sound loudly with more light and softly with less light shining on the Cretile Light Sensor.
Now put Switch in OFF position. The output of Switch changes to OFF which disables the Sensor Base
with Light Sensor. Thus Light Sensor does not respond to any changes in light shining on it. The output
of Light Sensor thus remains OFF. Buzzer receives OFF input and hence does not ring.
Below diagram shows different input and output states of Cretiles if Switch is in OFF position.
Below image shows Motion Sensor. It needs to be used with Sensor Base. It generates ON
output when Motion around it is detected. Otherwise it generates OFF output.
This sensor keeps emitting signals called microwave signal. The sensor can detect when
these microwave signals are obstructed by any movement around it. So, we can use this
sensor in our projects to detect person, animal or object movement etc. e.g. You can use
this sensor if we want to switch ON Buzzer/light when car arrives near parking lot.
Note that in the beginning this sensor needs about 30 seconds to start functioning. After
30 seconds, it will detect motions around it. So, when you start the project that involves
Motion Sensor, do not expect correct results for the first 30 seconds.
This sensor can work even if it is covered or kept inside a wooden drawer or inside a metal
box. This makes it easy to use in different projects. The sensor however cannot detect
motion beyond brick walls. It works both in dark as well as in light. Note that this sensor can
only detect motion of objects that are 5 centimeters or more away from the sensor. So, if
the object moving is too close to the sensor, it will not detect it.
Cretile Wire is used when you need to connect two Cretiles kept at a distance. Wire gives
you flexibility to keep the Cretile blocks in different location as per your project
requirement.
Connect Battery + Threshold with Sensor Base+ Mount light sensor on Threshold with Sensor Base+ Buzzer in
sequence & power-on the assembly. Keep the Cretile Threshold module at say 20% position. Keep this assembly
at a place where morning sunlight can fall on the Cretile Light Sensor. In the morning, when sunlight brightness
increases beyond 20%, the buzzer will start ringing. If you increase Threshold to 30% then it will take more light
for the alarm to turn ON
Cretile Motor also allows you to use other types of motors in your project. You can
connect motors such as High Speed Motor, Submersible Pump Motor and Vibration
Motor can be connected to Motor Module. We shall learn about this in the later
sections.
Connect
here
Make & learn: Let’s say you need to control High Speed motor speed using dimmer. Connect
Battery + Dimmer + Motor mounted with High Speed Motor in sequencer. Connect Motor Module
speed port at outputs of Dimmer. Now power ON the assembly. As you operate the dimmer, High
Speed motor speed changes simultaneously.
Connect
here
Now immerse the pump completely inside water as shown below to use it.
Power / Battery
Sensor base with Threshold
Obstacle Sensor
Buzzer
Make a car parking lot using cardboard as shown in image below. Fix the Obstacle sensor to the
rare side wall of the car parking.
Keep moving the car backwards and identify the position at which the Buzzer should start to ring.
At this position adjust the threshold of the sensor base.
The alarm should ring only if the car comes too close to the wall of the parking. If it is at safe
distance, then it should not ring.
When the car comes too close to the wall the Obstacle shall detect it and send ON signal to Buzzer
which will start ringing. This will assist the car driver in parking safely.
Improve this alarm system with more than one Obstacle sensor.
Power or Battery
Switch
Motion Detection Module
Motor Module
Pulley
Stick
Refill
Sheet of cardboard/foam sheet/sun-board
1. Battery
2. Sensor Base with Threshold
3. Motor Module
4. Obstacle Sensor
5. Submersible Water Pump
What is blinking?
Find any LED light in your house. Use button to switch on and then off for some time with same
gap of time. LED bulb or light will switch on and off with same interval. This is called blinking.
Now instead of manually pressing the button on and off if we had a program to do this then what
steps or commands will be required?
Write down these commands or steps on paper.
Power or Battery
Prologic
Light
Now upload this program to ProLogic and observe the output. You shall find that the Light switches
ON for a second and then switches OFF for one second and this keeps happening again and again.
‘if/else’ is used in situations where two outcomes are possible. For example, when we toss a coin,
there are only two outcomes- one is getting a heads and the other is getting a tails.
‘if/else’ block consists of three parts as shown below:
Battery Module
Dimmer
ProLogic
Light
Buzzer
2. Else, that means if Dimmer position is greater than 50 (values between 50 to 99) Buzzer should
be turned ON while the Light should remain OFF
Now check if the Dimmer position is below ‘50’ or not. To do so, use ‘if/else’ block with less
than (<) test condition
If condition is False (dimmer_reading is more than 50): We will write ‘99’ at OUT:2 to switch
ON the Buzzer and write ‘0’ to OUT:1 to switch OFF the Light
Use '60' as threshold value instead of '50'. Try other threshold values
If conditions is true
If conditions is false
Sometimes in lengthy programs, there can be chances of having same task to be performed at
different places of the code. It becomes a laborious task for the coder to write the same lines of
code many times in different places. So, we use ‘Subroutine’ for this purpose.
Same repeated commands are placed in a subroutine. Now repeated common commands are
replaced by calling the subroutine using a single line of code. Subroutine is also used to make the
code readable.
For example, every time we want to blink light we have to use 4 blocks
1. Write local output value 99
2. Delay few milliseconds
3. Write local output 0
4. Delay few milliseconds
Whenever we want to blink we need to write above commands. But if we give name to these 4
commands as Blink, then whenever we want to blink we will refer to these commands simply by
name Blink without writing all the commands required to blink.
There are two parts for using subroutine:
1. Subroutine
2. Calling the subroutine
Battery
2 Switches
ProLogic
Light
Variables act as memory that we can read and write in a program. They are like storage boxes where
we can store any item safely and sometime later we can open the box and use items kept in it. We
can even pass the box to someone else and he/she can open the box to access item stored in the
box. We generally label such box to identify what it contains. For example we label jars in kitchen
with Sugar, Salt etc. to identify them later easily.
In similar way, we can store any value in variable and later on read the value stored in the variable.
Like we label boxes, we give meaningful name to variables to identify what type of values it may
store.
Let’s learn how to use variables in Ardublock program.
Light Module
ProLogic
Push Button
Battery
Let’s write a simple program which will simply switch on Light until Push Button is pressed.
Connect ProLogic, Push Button, Light and Battery Module as shown in diagram below.
Sometimes in lengthy programs, there can be chances of having same task to be performed at
different places of the code. It becomes a laborious task for the coder to write the same lines of
code many times in different places. So, we use ‘Subroutine’ for this purpose.
Same repeated commands are placed in a subroutine. Now repeated common commands are
replaced by calling the subroutine using a single line of code. Subroutine is also used to make the
code readable.
For example, every time we want to blink light we have to use 4 blocks
5. Write local output value 99
6. Delay few milliseconds
7. Write local output 0
8. Delay few milliseconds
Whenever we want to blink we need to write above commands. But if we give name to these 4
commands as Blink, then whenever we want to blink we will refer to these commands simply by
name Blink without writing all the commands required to blink.
There are two parts for using subroutine:
3. Subroutine
4. Calling the subroutine
Battery
ProLogic
Motors - 2
Wheels – 2
USB Cable
Place the entire assembly on the cardboard as shown in figure. Also, connect the wires from the
motor modules to the ProLogic as shown in figure.
2. Backward
3. Right
4. Left
5. Stop
1. Forward- As motor are connected in opposite direction. To make Robot move Forward, M1
motor should rotate in clockwise/forward direction and M2 motor in anti-clockwise/reverse
direction. So the robot will move forward on using this subroutine.
3. Right- As motor are connected in opposite direction. To make Robot turn right both motors
should rotate in anti-clockwise/reverse direction. So the robot will turn right on using this
subroutine.
5.Stop- This subroutine makes both the motor speed to zero. So the car will stop on using this
subroutine.
Obstacle detection can be very useful in the robotics. Have you seen a floor cleaning robot?
If we develop (floor) cleaning robot then obstacles like table, chair, cupboard etc. will be a
problem for the robot and robot has to avoid hitting them and avoid getting stuck at one place
while cleaning room.
Hence if we use obstacle detection system, robot can change direction when it encounters an
obstacle.
ProLogic
Data cable
Battery
Motors
2 Robotic wheels
2 Obstacle sensors
5 mm sun board
Attach the caster wheel to the bottom side of the sun board
Place the Obstacle Sensor on the front side of the robot as shown in figure.
Make & learn: Connect Battery + Switch + NOT + Light in sequence & power-on the assembly. When
you operate Cretile Switch to ON position the Light switches OFF. Similarly, when you operate Cretile
Switch to OFF position the Light switches ON
You can use Cretile Connectivity to test electrical conductivity of an object. Connect the
Cretile Connectivity to Cretile Switch as below. Now connect pins on two sides of the
object to be tested. If the object is good conductor of electricity, then Cretile Switch
switches ON.
LED glows if
current
Connect passed
here through the
object under
test
You can connect Limit Switch to Push Button as well instead of Switch.
Now disconnect the sensor pins from coin and connect those to a plastic piece. As plastic
is bad conductor of electricity, sensor generates OFF at the output of Push Button and
hence Buzzer starts to ring.
Cretile Switch or Push Button can be extended to operate using a Limit Switch as shown
below. This way Cretiles connected to Switch can now be switched ON or OFF either by
operating the button on the Switch or by operating the Limit switch.
Press either
of them to
switch ON
LED glows
when
switched
ON
Connect
here
You can connect Limit Switch to Push Button also. Once connected it would look like as
below.
U- Right in the circuit will add a row to the bottom of the circuit and reduce the length of
the circuit
Cretile Pulse/Delay can perform two functions: A Time Pulse or Time Delay.
The functionality can be decided by using mode switch. It has one input and one output.
MODE SWITCH
Cretile pulse is used in situations where you want the action to happen only for a certain
amount time.
Make & learn: Let’s make a project that keeps the Cretile Light switched ON for 10 Seconds
only. Battery Module + Push Button+ Pulse/Delay + Light in sequence. Put the Cretile
Pulse/Delay in Pulse mode. Set the Pulse value to 10 seconds with ‘CHANGE VALUE'
buttons. Use ‘SAVE’ switch to store the Pulse value for future use. Now operate Cretile Push
Button once. You will observe that the Cretile Pulse starts counting down from 10 to zero.
During this period the Cretile Light remains ON. Once the countdown reaches zero, the
Cretile Light goes OFF.
Cretile Delay is used in situations where you want the action to happen after a certain
amount of time.
Make &learn: Let’s make a -down alarm. Use Battery + ON/OFF Switch + Pulse/Delay +
Buzzer in sequence. Initially keep the Cretile Switch in OFF position. Set the Cretile
Pulse/Delay to delay mode. Set the Delay value to 10 seconds with ‘CHANGE VALUE'
buttons. Use ‘SAVE’ switch to store the Delay value for future use. Now operate Switch to
ON position. You will observe that the Cretile Delay starts counting down from 10 to zero.
During this 10 second period the Cretile Buzzer remains OFF. Once the countdown reaches
to zero, the Buzzer starts to ring.
You have delayed the action of switching ON the Buzzer by 10 seconds after operating
the switch.
Cretile Transmitter and Cretile Receiver talk to each other wirelessly. It gives your projects
ability to remotely control and take action. Cretile Transmitter has four inputs. It sends these
four input values wirelessly to Cretile Receiver.
Cretile Receiver and Transmitter need separate power supply. You can use either Cretile
Power or Cretile Battery for supplying power to Cretile projects.
Make & learn: Connect Cretile Switch to one of its inputs of Cretile Transmitter, say Input-3 (IN-3).
Connect Cretile Light to corresponding output of Receiver, in this case Output-3 (OUT-3). Now
operate the switch on the Cretile Switch to ON position. It will switch ON the Cretile Light connected
at Receiver.
You can connect any or all the four inputs at Transmitter to control corresponding four outputs
connected at Receiver.
Make & learn: Connect Cretile Magnetic Sensor to Cretile Sensor Base with Threshold. Now, connect
Battery + Sensor Base with Threshold (with magnetic sensor mounted on it) + Light in sequence. Now
bring a strong magnet close to the senor. You will observe that the Light glows when the magnet is
close to the sensor.
Cretile Tilt Sensor detects the surface is titled on not, on which it is placed. To use it, you
need to connect it to the Cretile Sensor Base.
Cretile Tilt Sensor by default remains OFF when placed on a flat surface that is parallel to
ground e.g. on the top surface of a table. It is switched ON when the sensor or surface on
which it is mounted is tilted.
Connect
here
Make & learn: Connect Cretile Battery + Dimmer + Servo Motor in sequence as shown below. Switch
the Battery ON and operate the Dimmer for different values. You will observe that the shaft of the
motor moves according to the Dimmer position.
Cretile AND provides functions of AND Logic Gates. Cretile AND has two inputs and one
output. Below table explains how AND Logic Gate function depending on inputs provided
to it.
AND
IN1 IN2 OUT
ON ON ON
ON OFF OFF
OFF ON OFF
Cretile OR provides functions of OR Logic Gates. Cretile OR has two inputs and one
output. Below table explains how OR Logic Gate function depending on inputs provided
to it.
OR
IN1 IN2 OUT
ON ON ON
ON OFF ON
OFF ON ON
Toggle is not a Logic gate. Toggle reverses the currently present output. So, upon switching
ON input, if the present output is ON, it goes to OFF state. Similarly, upon switching ON
input, if the present output is OFF, it goes to ON state.
A real life example is TV power that toggles when remote input is given. On pressing the
power button on the remote the TV switches ON if it is currently OFF. Otherwise, it switches
OFF if already ON.
Below table shows how Toggle input will change the output
TOGGLE
INPUT OUT
First ON ON
Second ON OFF
Third ON ON
Forth ON OFF
And so on….
Retains previous
OFF
output
Once you press the Push Button at Input the Light will switch ON. If you press the Push Button again,
the output will switch OFF. So, output toggles between ON and OFF every time Push Button is pressed
at the input.
Cretile SmartSwitch lets you to control 240V/5A appliance with Cretile. Cretile SmartSwitch
looks like a regular wired extension box that we use in home or offices. It has one Cretile
input. You can control an appliance connected to SmartSwitch with Cretile logic
connected at this Cretile input.
Two-way 240V/5A
ON/OFF Power Inlet
Switch
WARNING: Do not connect any appliance that has rating above 240V/5A rating. Typically,
in India, appliances such as a table lamp, night lamp/ Phone chargers etc. should be of
rating equal to or below 240V/5A rating. However, read appliance rating and ensure
compatibility before connecting. If you are not sure, do not connect appliance to
SmartSwitch. Take help from an expert or call/email to Cretile support for further assistance.
Make & learn: Let’s control a table lamp with Motion detection. Make the connections as below.
Connect the table lamp at SmartSwitch socket.
Now switch the Cretile Battery ON. Motion Sensor starts to detect the motion around it. When some
motion happens around Motion Sensor it switches ON the table lamp. With Pulse the table lamp
shall remain ON for at least time set on it. When motion around the Motion Sensor stops, it will switch
OFF the table lamp.
Note: Motion Sensor takes about a minute to start functioning correctly. After powering ON, wait for
about a minute before you expect your Motion Sensor based projects to function correctly.
You will find that SmartSwitch also an ‘Two-way ON/OFF’. This switch alongwith ‘Cretile
Input’ operates the applience connected to it. Below table illustrates the same.
Note that, when Cretile input is OFF and Two-way switch is also in OFF position the
applience conneced to SmartSwitch switches ON.
If you find any issue with your kit, do not worry; report the same by writing an email to
support@cretile.com and include the below items in the email
Use suitable subject line such as “Need support for Cretile kit – Your Name”
In the body of the email mention the below:
o Your Name:
o Address:
o Phone Number:
o Kit Name:
o Date of purchase:
o Where did you purchase the kit:
o Describe the problem you have identified with the kit
Attach relevant photos/short videos of the same problem. This could help us resolve
the issue faster for you
We will revert to your email at earliest we can. Typically, it could take from a couple of
days to a week for us to contact to you.
1. Ensure that Cretiles are firmly connected to each other and there is no gap left between
two Cretiles
Incorrect
connection
Correct
connection
2. Low charge on battery: one of the primary causes of your Cretile assembly not working
as expected could be that the batteries that you are using have ran out of power. Try with
new batteries or charge the batteries sufficiently in case you are using rechargeable
batteries.
Note that ‘Battery & Power’ combined Cretile has a low battery indicator as shown below
1. Only use Arduino/ArduBlock software version provided by Cretile. The latest version
can be found at www.cretile.com in the downloads section
2. When you open the development environment, sometimes, it shows you a message
stating a new version of the software is available to upgrade. DO NOT upgrade to
newer version; click ‘No’ and continue.
3. Open Arduino IDE, go to ‘Tools’ menu and click on the ‘Board’ sub-menu. In this
‘Arduino Nano’ must be selected while working with ProLogic
4. Open Arduino IDE, go to ‘Tools’ menu and click on the ‘Port’ sub-menu. A COM port
where ProLogic is connected must be selected. Note that if you see more than one
COM port in the ‘Port’ menu then disconnect the ProLogic and check the COM ports
visible in the ‘Port’ menu and make a note of them. Now again connect the ProLogic
and check which COM port newly got added to this list. This newly added com port is
what you should select.
1. When you remove, reconnect the USB cable between your PC and ProLogic, you
might have select the COM port from the tools menu of Arduino IDE.
Copyright @ MakerInMe Technologies Private Limited P a g e | 72
2. When you drag a block from drawer and drop it in canvas, it comes with some
default parameters e.g. WRITE block will come with OUT-# as 1 and data as ‘99’.
Remember to update it as per connections in your setup.
3. While working with remote inputs and remote outputs, ProLogic must be switched ON
first. Only after ProLogic is switched ON, TX and RX should be switched ON. The order of
TX and RX switching ON does not matter as long as ProLogic is switched ON first.
4. One of the Setup block is present in ArduBlock Setup section
5. You must connect Battery/Power to ProLogic and keep the Battery/Power switch to
ON position
1. Ensure that you have installed ‘Cretile.apk’ in your Android device. Without this app,
the application that you have developed will not be able to communicate with
ProLogic. Refer to ‘Setting up your Android Device’ section from the manual for
instruction to install ‘Cretile.apk’
2. Ensure that you are using a USB data cable to connect ProLogic and Android
device. Some of the USB cables have only charging capabilities and not data transfer
capabilities.
Thank you for purchasing Cretile. Please read the instruction manual carefully before using the product.
Please ensure that the product is used under adult supervision.
A PRODUCT OF