Product Rating

ARDULEGO KIT: create with Lego and Arduino – Open Electronics

 

A lot of parts to make functions that may be programmed with Arduino and assembled like LEGO bricks.

 

What number of instances did you dream of constructing one thing with LEGO bricks whenever you had been a baby and see it shifting, animated, maybe integrating a certain quantity of programmable electronics to maintain up with the instances? Nicely, because of ARDULEGOKIT, that dream can come true, as a result of it’s a set of LEGO-compatible blocks geared up with digital parts of varied sorts, to create animated constructions. However the enjoyable doesn’t finish there, as a result of the digital parts contained within the ARDULEGOKIT bundle may be managed by way of Arduino (an Arduino Uno board to be precise), which makes the world of LEGO electronics much more attention-grabbing and accessible to those that dabble in electronics and those that use it for instructional functions.

 

A LOOK INSIDE THE KIT

Designing, constructing and having enjoyable: that is the goal of the ARDULEGOKIT, accessible from Open Electronics (www.open-electronics.org) in a sensible toolbox, containing, divided into small containers, numerous modules designed to be positioned on LEGO bricks and used to create robotics functions and workout routines.

It comes with a handout, and a tutorial guide, which can enable you to experiment with sketches to check the varied modules with the Arduino Uno and the Sensor Defend (we’ll clarify what that is quick).

However what are the options of the ARDULEGOKIT and the way are its parts made? Nicely, the primary one is that every digital element shouldn’t be the basic single element to be soldered, however it’s soldered on a printed circuit board, due to this fact provided within the type of a breakout board, thus permitting those that use this equipment to not need to cope with soldering and to grasp with excessive practicality and ease the connections required by the circuit they will design.

For instance, if we wished to attach an LED to the Arduino, we might usually need to calculate its falling resistance (R) utilizing the method:

R = (V – Vs)/ I

 

the place I is the present absorbed by the LED, Vs the direct voltage of polarisation of the LED and V the provision voltage from which we begin; however within the case of the LED module provided within the equipment, we will join it on to Arduino with out worrying about protections. Moreover, every module with an digital element onboard has three or extra holes that match completely with the LEGO bricks, so along with the straightforward electrical connection, there’s the benefit of good mechanical integration with the LEGO setting and in addition the bodily assist. With a view to dealing with the Arduino, the equipment features a protect particularly designed to attach the varied parts. This protect sits on high of the Arduino Uno and extends the ports current, the variety of digital (14) and analogue (6) pins stays the identical, however every of them is supplied with two extra pins, one for GND and one for VCC (5V), this protect additionally has pins devoted to using sure sensors akin to 6 pins devoted to the SD card interface, 4 pins for the SR-HC04 ultrasonic sensor, 6 pins for the HC-05 and HC-06 Bluetooth modules, 6 pins for the APC220 wi-fi interface, 4 pins for the I²C-Bus interface, 4 pins for the serial communication interface, 6 pins for the serial LCD show and 14 pins for the parallel LCD show.

The connection between the Arduino and the PC for programming is made by way of a USB cable provided within the equipment itself, whereas the connection between the microcontroller and the varied modules is made by way of three, 4 or five-wire Dupont cables, relying on the module getting used. It is very important keep in mind that the three-wire Dupont cables have completely different colors in response to the pin for use: GND=black, VCC=pink, Sign=yellow, whereas the 4 and five-wire Dupont cables would not have completely different colors.

Utilizing the varied modules may be very easy even for many who have by no means labored with electronics since there isn’t any must dimension different parts, however on the identical time, it is usually very attention-grabbing for many who are extra skilled on this area since parts will not be included within the equipment, akin to these illustrated above, can be linked to the protect.

We’ll now have a look at and describe a few sensible functions designed to familiarise you with the varied modules contained within the ARDULEGOKIT.

 

A TRAFFIC LIGHT FOR OUR BRICK CITY

Who amongst us has by no means tried to create their very own metropolis with LEGO? There are those that construct regular cities, like those we stay in, those that construct cities set in numerous historic eras, those that have them colonised by aliens or those that construct super-technological cities with Futurama-style flying vehicles. However along with folks and automobiles, don’t we wish to have a visitors gentle? Maybe animated and dealing, with LEDs that really gentle up, performing the sunshine sequence of an actual visitors gentle like those we discover on the streets? And with a name button for pedestrians?

If that is what we wish, ARDULEGOKIT can assist us make it a actuality.

The fabric required to make this utility is as follows:

  • pink, inexperienced and yellow and RGB LED modules;
  • contact sensor;
  • Arduino One.

 

When you’ve received all of the instruments you want, you possibly can construct your individual visitors gentle. It may be tall, low, crooked, held on a wire, you identify it, and use the LED modules within the equipment as gentle. We additionally use the RGB LED to create a pedestrian name gentle managed by a contact sensor.

As soon as the visitors gentle is constructed, we join the LED modules and the contact sensor with three-wire Dupont cables: GND, VCC and Sign (one of many D0-D13 digital pins) whereas we join the RGB LED with a four-wire Dupont cable: VCC and R G B (three completely different D0-D13 digital pins are wanted).

The pins supposed for the LEDs might be outputs, whereas the contact sensor might be an enter; in actual fact, the latter works virtually like a button, so it releases a excessive worth whether it is pressed and a low worth if it isn’t pressed. The sensor in query is predicated on the detection of {the electrical} capability of a capacitor: the circle we see once we have a look at it constitutes an armature of the digital capacitor and when a physique able to conducting (in our case a finger) approaches, it varieties the second armature. At this level, a switch {of electrical} cost happens because of the electrical area created between these armatures, and the ensuing subtraction of cost is detected by the electronics constructed into the sensor.

 

Fig. 1 reveals our visitors gentle assembled and positioned on a LEGO mannequin.

 

Nicely, having mentioned that, we’ve defined the electronics and we will now dedicate ourselves to the software program facet, with the appliance code proven in Itemizing 1: in it, we see that the visitors gentle LEDs are managed by digital pins 11 (inexperienced) 12 (yellow) and 13 (pink), whereas digital pins 8 (blue) 9 (inexperienced) and 10 (pink) are assigned to drive the RGB LED. The contact sensor is learn by way of digital I/O 7, which has been initialised as an enter.

Itemizing 1

#outline ledAutoR 13 //pink LED module
#outline ledAutoG 12 //yellow LED module
#outline ledAutoV 11 //inexperienced LED module
#outline ledPedoniR 10 //RGB pink
#outline ledPedoniG 9 //RGB inexperienced
#outline ledPedoniB 8 //RGB blue linked simply to keep away from having a cable round
#outline contact 7 //sensor
//ready time
int intervallo=5000;
int worth; //variable for studying
void chiamata();
void setup() {
// definizione enter output
pinMode(ledAutoR, OUTPUT);
pinMode(ledAutoG, OUTPUT);
pinMode(ledAutoV, OUTPUT);
pinMode(ledPedoniR, OUTPUT);
pinMode(ledPedoniG, OUTPUT);
pinMode(ledPedoniB, OUTPUT);
pinMode(contact, INPUT);
}
void loop() {
worth=digitalRead(contact);
if(worth==HIGH){ //visitors gentle name
chiamata();
}
//pink automotive led inexperienced pedestrian led
digitalWrite(ledAutoR, HIGH);
digitalWrite(ledAutoG, LOW);
digitalWrite(ledAutoV, LOW);
digitalWrite(ledPedoniR, LOW);
digitalWrite(ledPedoniG, HIGH);
digitalWrite(ledPedoniB, LOW);
delay(intervallo);
//Yellow LED Automobile Inexperienced LED Pedestrian
digitalWrite(ledAutoR, L

 

 

A GARAGE FOR SORTING SUPERCARS

We don’t essentially have to depart our supercar on the street, even whether it is made from LEGO; for instance, we will retailer it in a comfortable storage. To make this storage extra practical, we will add some digital alerts to point to the mini-figures passing by within the mannequin if and which automotive is about to depart its storage, with a view to keep away from disagreeable accidents!

A type of energetic signposting that wouldn’t harm in actuality.

The fabric required for this train is as follows:

  • LED module of your alternative;
  • buzzer with or with out electronics;
  • photo-resistance or ambient gentle sensor;
  • Arduino One.

To begin with, we’ve to construct a storage appropriate for our supercar(s). As soon as that is executed, we’ll place the photoresistor contained in the storage. The photoresistor is a variable resistor that reviews a bigger or smaller analogue worth relying on the quantity of sunshine perceived, whereas the ambient gentle sensor works in the identical manner however shouldn’t be a variable resistor. The brighter the setting, the nearer the values are to zero; vice versa at nighttime. The LED and the buzzer, alternatively, we’ll place outdoors the storage.

As for the 2 gentle sensors, since they’re analogue sensors, their Sign pin ought to be linked to one of many analogue ports of the Arduino Uno, whereas the buzzer and the LED are each assigned to digital outputs. Since they each work on the idea of sunshine, it’s all the time greatest to check what they sense when the storage is open and when the storage is closed with a view to discover an approximate threshold worth.

This may be executed utilizing the code beneath.

#outline fotoresistenza A0

int valueF;

void setup() { 

  pinMode(fotoresistenza, INPUT);

  Serial.start(9600);

}

void loop(){

    valueF=analogRead(fotoresistenza);

    Serial.println(valueF);

}

 

The selection of the buzzer is subjective as a result of in the marketplace this element is present in numerous variations, able to emitting sounds at completely different frequencies. However that’s not all, as a result of there are buzzers with and with out electronics: if we use a buzzer with electronics, we will additionally merely join it to the facility provide and it’ll begin to sound because of a element in it that triggers the oscillation, whereas if we use a buzzer with out electronics (which is a pure piezo pad) it should be pushed with a one-way variable voltage, in any other case it won’t emit any sound. Within the case of use with Arduino, within the first case, digital output at excessive logic stage is enough, whereas within the second case it’s essential to drive the buzzer with a PWM digital pin of Arduino Uno and activate it from software program.

On this equipment there are each sorts of buzzers: the one with electronics has a sticker on the highest, whereas the one with out electronics doesn’t.

As soon as we’ve discovered the edge worth and determined which buzzer to make use of, we will consider the ultimate design. The LED and buzzer will stay off till the photoresistor detects a enough worth better than the indicated threshold worth.

The firmware to be written to grasp the appliance is proven in Itemizing 2.

In it we see that the acoustic signalling is completed by digital pin 8, the switching on of the signalling LED that illuminates the street sign by pin 13 and the studying of the photoresistor is completed by analogue line A0, which on this case acts as an enter.

Within the loop, we’ve the cyclical studying of the photoresistor standing and the resultant administration of the visible (LED) and acoustic (buzzer) signalling.

Itemizing 2

#outline buzzer 8
#outline led 13
#outline fotoresistenza A0
int sensorValue = 0;
int soglia=150; //photoresistance threshold
void setup() {
// put your setup code right here, to run as soon as:
Serial.start(9600);
pinMode( fotoresistenza, INPUT);
pinMode( led, OUTPUT);
pinMode( buzzer, OUTPUT);
}
void loop() {
// put your major code right here, to run repeatedly:
sensorValue = analogRead(fotoresistenza);
Serial.println(sensorValue);
if(sensorValue>soglia){
digitalWrite(led, HIGH);
digitalWrite(buzzer, HIGH);
delay(100);
}
else{
digitalWrite(led,LOW);
noTone(buzzer);
}
}

 

 

SAFE DRAWER

We now transfer on to our third educating utility, which consists of constructing a “protected” drawer.

Run out of concepts about the place to cover valuables? There’s no cause why you shouldn’t put them in a drawer made from LEGO, even higher if it has a classy burglar alarm system.

So let’s see what we have to make this utility; the fabric required is:

ambient gentle sensor or photoresistor;

  • LED;
  • buzzer;
  • IR receiver;
  • IR distant management;
  • button;
  • Arduino One;
  • 3V CR2025 battery (not included within the equipment).

 

The operation of this “clever” drawer is, to say the least, easy however on the identical time suggestive: the ambient gentle sensor or the photoresist, positioned on the high of the drawer, will detect when the drawer is opened; however the system is designed in such a manner that so as to not set off the alarm, it’s first crucial to pick the right key utilizing the distant management, with a view to authenticate oneself.

If the button is the appropriate one, the “clever” drawer will recognise us because the proprietor, in any other case, the buzzer will sound and the LED will flash. On the identical time, a 16×2 show on the I²C-Bus interface will present both the message “welcome” or the message “to the thief” (Fig. 2) relying on whether or not the individual opening the drawer has authenticated himself or not.

The 16×2 LCD (Liquid Crystal Show) (16 columns and a pair of rows for writing) with I²C (Inter-Built-in Circuit, a protocol that enables alerts to journey in parallel) interface is an alphanumeric show to indicate on display screen writings, numbers or values that might usually be displayed on the Arduino serial monitor.

On this equipment, the show is already soldered to the I²C interface. It has 4 pins: GND, VCC(5V), SDA (knowledge) and SCL (clock sign) to be linked respectively to the pins devoted to the I²C-Bus interface.

 

Fig. 2

 

Due to the SDA and SCL pins we will join as much as 4 shows in parallel, differentiating every system with a special deal with.

On the entrance of the LEGO brick drawer is a backlit LCD show, and on the rear, on the I²C interface, is a trimmer from which the brightness of the show may be adjusted.

To grasp the way it works, seek advice from the code in Itemizing 3.

Itemizing 3

//library required to make use of the show
#embody <LiquidCrystal_I2C.h>
//liquid crystal display is the identify of the show on this sketch
//0x27 is the show deal with
//16 is the variety of columns (0-15)
//2 is the variety of rows (0-1)
LiquidCrystal_I2C liquid crystal display (0x27, 16, 2);
void setup() {
liquid crystal display.init(); //initialises the show
liquid crystal display.backlight(); //initialises the backlight
}
void loop() {
//to maneuver the show cursor
liquid crystal display.setCursor(colonna, riga);
//to write down textual content I take advantage of ("")
liquid crystal display.print(“testo”);
//to write down a variable I solely use the ()
liquid crystal display.print(variabile);
}

 

 

The distant management makes use of infrared expertise to speak with the IR receiver module. The receiver has 3 pins: GND, VCC (5V) and Sign (digital pin D11), whereas the distant management has 10 numeric keys, 4 arrows, hash mark, asterisk and okay. Infrared transmission is at a excessive frequency (roughly 38 kHz) from the distant management, which emits a sequence of bits (0 and 1) representing the varied buttons; this sequence is intercepted by the receiver which, by way of this system, is aware of which button it corresponds to.

The button has the duty of constructing this system retailer the precise code, which is why it should be positioned hidden.

Additionally, for this program (its code is proven in Itemizing 4) it’s higher to judge the precise threshold worth of the photoresistor (learn from analogue pin A0) contained within the gentle sensor. Within the code we see to begin with the inclusion of the library for the infrared sensor, which is learn from pin D11; the LED is as a substitute pushed by Arduino Uno’s D13 and the buzzer by D8. D3 is used to learn the button.

Within the loop, the button is managed with its studying, in addition to the replace of the LCD show for which the LiquidCrystal_I2C.h library was included at the start. The studying of the sunshine sensor to confirm the opening of the drawer and the prior reception of the code of the alarm launch button are additionally managed.

Itemizing 4

//library required for infrared management
#embody <IRremote.h>
//library required for displya
#embody <LiquidCrystal_I2C.h>
#outline IR_RX 11 //pin del ricevitore IR
#outline LED 13
#outline button 3 //settings button
#outline buzzer 8
#outline luce A0
int soglia=150; //threshold worth gentle
unsigned lengthy tasto; //variable with the important thing code
IRrecv irrecv(IR_RX); //declaration iR
decode_results outcomes; //conversion from bit to decimal
//liquid crystal display is the identify of the show on this sketch
//0x27 is the show deal with
//16 is the variety of columns (0-15)
//2 is the variety of rows (0-1)
LiquidCrystal_I2C liquid crystal display (0x27, 16, 2);
void setup()
{
pinMode(luce, INPUT);
pinMode(LED, OUTPUT);
pinMode(button,INPUT);
pinMode(buzzer,OUTPUT);
irrecv.enableIRIn(); //IR activation
Serial.start(9600);
liquid crystal display.init(); //initialises the show
liquid crystal display.backlight(); //initialise backlighting
}
int on = 0;
unsigned lengthy final = millis();
void loop() {
Serial.println(tasto);
int buttonState = digitalRead(button);
delay(100);
if ( buttonState == HIGH) {
Serial.println(“Impostazioni...”);
if (irrecv.decode(&outcomes) && millis() - final > 250){
tasto = outcomes.worth;
Serial.println(“Memorizzo il nuovo codice”);
Serial.println(tasto); //secret's the variable the place the right secret's saved
Serial.println(outcomes.worth);
final = millis();
irrecv.resume();
}
}
if (irrecv.decode(&outcomes)){
if ((millis() - final > 250 && outcomes.worth==tasto )&&(analogRead(luce)>soglia)) {
//to maneuver the show cursor
liquid crystal display.setCursor(0, 0);
//to write down textual content I take advantage of ("")
liquid crystal display.print(“benvenuto”);
digitalWrite(buzzer, LOW);
}
else if ((millis() - final > 250 && outcomes.worth!=tasto )&&(analogRead(luce)>soglia)) {
digitalWrite(LED, HIGH);
digitalWrite(buzzer, HIGH);
liquid crystal display.clear();
liquid crystal display.setCursor(0, 0);
liquid crystal display.print(“al ladro”);
}
final = millis();
irrecv.resume();
}
}

 

 

THE INTELLIGENT VASE

And right here we’re on the final instructional utility that we’ll suggest on this article and that considerations those that have a kind of “inexperienced” “thumb”. These days LEGO bricks are used to make something, so why not use them to construct a pot for a plant? Maybe with sensors utilized to inform us when the little plant inside is “thirsty” and wishes watering?

Nicely, if you wish to do this and construct this ‘good’ pot, it’s essential to use the next parts:

  • soil moisture sensor;
  • liquid stage sensor;
  • Pink and inexperienced LEDs;
  • Arduino One.

 

Maybe we must always use Lego Duplos to make a vase, to make life a bit of simpler, however don’t fear about compatibility between the 2 ‘collection’ of bricks, as a result of the LEGO bricks match completely into the Duplos.

The goal of this experiment is to observe the well being of a plant utilizing two sensors.

The primary is the one which measures soil moisture by detecting the volumetric water content material, which is completed by detecting the dielectric fixed of the soil utilizing capacitive expertise. The measurement system makes use of a frequency of 70 MHz, which minimises interference resulting from salinity. The second sensor detects the extent of water current, offering a corresponding voltage worth on an analogue pin; it gives zero volts if it isn’t in touch with the water, however as it’s immersed the conductivity will increase and so do the output values.

The LEDs are used to point the present standing of the plant. For each sensors, nonetheless, threshold values should be calculated, that are then imported into the ultimate program; the routine for calculating the humidity utilizing the liquid stage sensor is as follows:

 

#outline Lacqua A0

int valueL;

void setup() { 

  pinMode(Lacqua, INPUT);

  Serial.start(9600);

}

void loop(){

    valueL=analogRead(Lacqua);

    Serial.println(valueL);

}

 

As a substitute, the one for calculating the edge worth for the dry land situation is:

 

#outline Hterra A0

int valueH;

void setup() { 

  pinMode(Hterra, INPUT);

  Serial.start(9600);

void loop(){

    valueH=analogRead(Hterra);

    Serial.println(valueH);

}

 

As soon as the suitable measurements have been made, we will take a look at the ultimate program, which corresponds to the code proven in Itemizing 5.

Itemizing 5

#outline Hterra A0
#outline Lacqua A1
#outline ledR 13
#outline ledV 12
int sogliaTerra = 150;
int sogliaAcqua = 150;
int valueH, valueL;
void setup() {
// put your setup code right here, to run as soon as:
pinMode(Hterra, INPUT);
pinMode(Lacqua, INPUT);
pinMode(ledR, OUTPUT);
pinMode(ledV, OUTPUT);
}
void loop() {
// put your major code right here, to run repeatedly:
valueH = analogRead(Hterra);
valueL = analogRead(Lacqua);
if((valueH>sogliaTerra)||(valueL>sogliaAcqua)){
digitalWrite(ledR, HIGH);
digitalWrite(ledV, LOW);
}
else{
digitalWrite(ledR, LOW);
digitalWrite(ledV, HIGH);
}
}

 

 

CONCLUSIONS

On this article, we’ve introduced the ARDULEGOKIT, a set of digital parts in breakout board format designed to be utilized to LEGO bricks and for use in functions ruled by digital circuits managed by Arduino Uno by way of the interface offered by a particular protect.

These are 4 utility examples to be thought of as workout routines during which we’ve tried to indicate you the right way to use as many circuit parts as doable, additionally explaining the right way to write firmware to implement the administration by way of the Arduino Uno board.

After all, on the idea of what has been defined, every of you possibly can develop functions as you see match.

Even earlier than the looks of instructional units such because the ARDULEGOKIT, it was troublesome, to say the least, to restrict your creativeness when utilizing LEGO bricks. Now, because of the probabilities of this equipment, whether or not you’re an skilled or a newbie on the earth of electronics and programming, you possibly can lastly say goodbye to the bounds of your creativeness and have enjoyable with LEGO and its developments.

 

FROM OPENSTORE

ARDULEGOKIT

 

Leave a Comment

13 + 9 =