Saturday, December 3, 2022
HomeElectronicsARDULEGO KIT: create with Lego and Arduino - Open Electronics

ARDULEGO KIT: create with Lego and Arduino – Open Electronics


 

Numerous parts to make purposes that may be programmed with Arduino and assembled like LEGO bricks.

 

What number of occasions did you dream of constructing one thing with LEGO bricks if you have been a baby and see it shifting, animated, maybe integrating a certain quantity of programmable electronics to maintain up with the occasions? 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 components contained within the ARDULEGOKIT package deal could be managed by way of Arduino (an Arduino Uno board to be precise), which makes the world of LEGO electronics much more fascinating and accessible to those that dabble in electronics and people who use it for academic functions.

 

A LOOK INSIDE THE KIT

Designing, constructing and having enjoyable: that is the intention of the ARDULEGOKIT, out there from Open Electronics (www.open-electronics.org) in a sensible toolbox, containing, divided into small containers, a lot of modules designed to be positioned on LEGO bricks and used to create robotics purposes and workouts.

It comes with a handout, and a tutorial handbook, which is able to allow you to experiment with sketches to check the assorted modules with the Arduino Uno and the Sensor Protect (we’ll clarify what that is brief).

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

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

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 availability voltage from which we begin; however within the case of the LED module equipped within the package, we will join it on to Arduino with out worrying about protections. Moreover, every module with an digital part onboard has three or extra holes that match completely with the LEGO bricks, so along with the straightforward electrical connection, there may be the benefit of excellent mechanical integration with the LEGO setting and in addition the bodily help. With a view to dealing with the Arduino, the package features a defend particularly designed to attach the assorted parts. This defend 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 defend additionally has pins devoted to using sure sensors similar 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 through a USB cable equipped within the package itself, whereas the connection between the microcontroller and the assorted modules is made through three, 4 or five-wire Dupont cables, relying on the module getting used. You will need to keep in mind that the three-wire Dupont cables have completely different colors in line with the pin for use: GND=black, VCC=purple, Sign=yellow, whereas the 4 and five-wire Dupont cables should not have completely different colors.

Utilizing the assorted modules may be very easy even for individuals who have by no means labored with electronics since there isn’t a must measurement different parts, however on the similar time, it is usually very fascinating for individuals who are extra skilled on this discipline since parts are usually not included within the package, similar to these illustrated above, will also be related to the defend.

We’ll now take a look at and describe a few sensible purposes designed to familiarise you with the assorted 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 automobiles. However along with individuals and automobiles, don’t we need to have a site visitors mild? Maybe animated and dealing, with LEDs that truly mild up, performing the sunshine sequence of an actual site visitors mild like those we discover on the streets? And with a name button for pedestrians?

If that is what we would like, ARDULEGOKIT will help us make it a actuality.

The fabric required to make this software is as follows:

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

 

When you’ve obtained all of the instruments you want, you’ll be able to construct your personal site visitors mild. It may be tall, low, crooked, held on a wire, you identify it, and use the LED modules within the package as mild. We additionally use the RGB LED to create a pedestrian name mild managed by a contact sensor.

As soon as the site visitors mild 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; the truth is, 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 after we take 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 discipline created between these armatures, and the ensuing subtraction of cost is detected by the electronics constructed into the sensor.

 

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

 

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

Itemizing 1

#outline ledAutoR 13 //purple LED module
#outline ledAutoG 12 //yellow LED module
#outline ledAutoV 11 //inexperienced LED module
#outline ledPedoniR 10 //RGB purple
#outline ledPedoniG 9 //RGB inexperienced
#outline ledPedoniB 8 //RGB blue related 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){ //site visitors mild name
chiamata();
}
//purple automobile 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 Automotive Inexperienced LED Pedestrian
digitalWrite(ledAutoR, L

 

 

A GARAGE FOR SORTING SUPERCARS

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

A sort of lively signposting that wouldn’t damage in actuality.

The fabric required for this train is as follows:

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

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

As for the 2 mild sensors, since they’re analogue sensors, their Sign pin needs to be related 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 premise of sunshine, it’s all the time greatest to check what they sense when the storage is open and when the storage is closed so as to discover an approximate threshold worth.

This may be completed 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 available on the market this part 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 part 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 package there are each forms 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 got discovered the brink worth and determined which buzzer to make use of, we will think about the ultimate design. The LED and buzzer will stay off till the photoresistor detects a enough worth higher than the indicated threshold worth.

The firmware to be written to grasp the applying 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 highway 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 got the cyclical studying of the photoresistor standing and the ensuing 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 primary 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 instructing software, which consists of constructing a “protected” drawer.

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

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

ambient mild sensor or photoresistor;

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

 

The operation of this “clever” drawer is, to say the least, easy however on the similar time suggestive: the ambient mild 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 vital to pick the proper key utilizing the distant management, so as to authenticate oneself.

If the button is the fitting 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 similar 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 particular person 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 point out on display screen writings, numbers or values that may usually be displayed on the Arduino serial monitor.

On this package, 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 related 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 gadget with a unique tackle.

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 could be adjusted.

To know the way it works, discuss with 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 tackle
//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 assorted buttons; this sequence is intercepted by the receiver which, through 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 mild sensor. Within the code we see initially the inclusion of the library for the infrared sensor, which is learn from pin D11; the LED is as an alternative 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 originally. 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 mild
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 tackle
//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 is the variable the place the proper secret is 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 academic software that we’ll suggest on this article and that issues 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 desires watering?

Nicely, if you wish to do this and construct this ‘sensible’ pot, you could use the next components:

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

 

Maybe we must always use Lego Duplos to make a vase, to make life just a little 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 intention of this experiment is to watch 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 on account of 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 involved 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 an alternative, the one for calculating the brink 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 primary 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 got introduced the ARDULEGOKIT, a set of digital parts in breakout board format designed to be utilized to LEGO bricks and for use in purposes ruled by digital circuits managed by Arduino Uno by way of the interface supplied by a selected defend.

These are 4 software examples to be thought of as workouts by which we’ve got tried to point out you the right way to use as many circuit components as attainable, additionally explaining the right way to write firmware to implement the administration by way of the Arduino Uno board.

In fact, on the premise of what has been defined, every of you’ll be able to develop purposes as you see match.

Even earlier than the looks of academic units such because the ARDULEGOKIT, it was troublesome, to say the least, to restrict your creativeness when utilizing LEGO bricks. Now, because of the chances of this package, whether or not you might be an knowledgeable or a newbie on the earth of electronics and programming, you’ll be able to lastly say goodbye to the bounds of your creativeness and have enjoyable with LEGO and its developments.

 

FROM OPENSTORE

ARDULEGOKIT

 



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments