A number of 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 once you have been a toddler and see it transferring, animated, maybe integrating a certain quantity of programmable electronics to maintain up with the occasions? Properly, due to ARDULEGOKIT, that dream can come true, as a result of it’s a set of LEGO-compatible blocks outfitted with digital parts of varied varieties, to create animated constructions. However the enjoyable doesn’t finish there, as a result of the digital components contained within the ARDULEGOKIT package deal might be managed by means of Arduino (an Arduino Uno board to be actual), 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 academic functions.Rooma21.com
A LOOK INSIDE THE KIT
Designing, constructing and having enjoyable: that is the purpose of the ARDULEGOKIT, out there 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 purposes and workout routines.
It comes with a handout, and a tutorial guide, which can enable you experiment with sketches to check the assorted modules with the Arduino Uno and the Sensor Protect (we’ll clarify what that is quick).
However what are the options of the ARDULEGOKIT and the way are its parts made? Properly, the primary one is that every digital element just isn’t the traditional 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 package to not must cope with soldering and to grasp with excessive practicality and ease the connections required by the circuit they’ll design.
For example, if we wished to attach an LED to the Arduino, we might usually must 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 provision voltage from which we begin; however within the case of the LED module provided within the package, we are able to 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 excellent mechanical integration with the LEGO setting and likewise the bodily help. With a view to dealing with the Arduino, the package features a protect particularly designed to attach the assorted 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 comparable 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 provided 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 keeping with the pin for use: GND=black, VCC=pink, Sign=yellow, whereas the 4 and five-wire Dupont cables shouldn’t have completely different colors.
Utilizing the assorted modules could be very easy even for individuals who have by no means labored with electronics since there isn’t any must measurement different parts, however on the similar time, it is usually very attention-grabbing for individuals who are extra skilled on this area since parts are usually not included within the package, comparable to these illustrated above, can be related to the protect.
We are going to now have 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 reside in, those that construct cities set in several 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 wish to have a site visitors gentle? Maybe animated and dealing, with LEDs that really gentle up, performing the sunshine sequence of an actual site visitors gentle like those we discover on the streets? And with a name button for pedestrians?
If that is what we wish, ARDULEGOKIT will help 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 bought all of the instruments you want, you may construct your individual site visitors gentle. It may be tall, low, crooked, held on a wire, you title it, and use the LED modules within the package as gentle. We additionally use the RGB LED to create a pedestrian name gentle managed by a contact sensor.
As soon as the site 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 meant for the LEDs will probably be outputs, whereas the contact sensor will probably 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 after 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 as a result of 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 site visitors gentle assembled and positioned on a LEGO mannequin.
Properly, having stated that, we’ve defined the electronics and we are able to now dedicate ourselves to the software program side, with the applying code proven in Itemizing 1: in it, we see that the site 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 through 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 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 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 product of LEGO; for instance, we are able to retailer it in a comfy storage. To make this storage extra practical, we are able to add some digital indicators 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 sort of energetic 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 gentle sensor;
- Arduino One.
To begin with, we’ve 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 experiences a bigger or smaller analogue worth relying on the quantity of sunshine perceived, whereas the ambient gentle sensor works in the identical method however just isn’t a variable resistor. The brighter the setting, the nearer the values are to zero; vice versa at midnight. The LED and the buzzer, however, we’ll place outdoors the storage.
As for the 2 gentle sensors, since they’re analogue sensors, their Sign pin ought 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 at all times 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 completed utilizing the code under.
#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 are able to additionally merely join it to the ability provide and it’ll begin to sound due to a element in it that triggers the oscillation, whereas if we use a buzzer with out electronics (which is a pure piezo pad) it have to 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 degree is adequate, 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 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 brink worth and determined which buzzer to make use of, we are able to focus on the ultimate design. The LED and buzzer will stay off till the photoresistor detects a adequate worth larger 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 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 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 motive 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 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 package).
The operation of this “clever” drawer is, to say the least, easy however on the similar 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 method that so as to not set off the alarm, it’s first obligatory to pick out 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 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 couple of rows for writing) with I²C (Inter-Built-in Circuit, a protocol that permits indicators to journey in parallel) interface is an alphanumeric show to point out on display writings, numbers or values that will 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 are able to join as much as 4 shows in parallel, differentiating every gadget with a distinct 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 might 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 #embrace <LiquidCrystal_I2C.h> //liquid crystal display is the title 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 put in writing textual content I exploit ("") liquid crystal display.print(“testo”); //to put in writing a variable I solely use the () liquid crystal display.print(variabile); }
The distant management makes use of infrared know-how 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 have to 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 start 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 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 #embrace <IRremote.h> //library required for displya #embrace <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 title 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); //key's the variable the place the right key'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 put in writing textual content I exploit ("") 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 utility that we are going to 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 wishes watering?
Properly, if you wish to try this and construct this ‘good’ pot, it is advisable use the next components:
- soil moisture sensor;
- liquid degree sensor;
- Purple and inexperienced LEDs;
- Arduino One.
Maybe we should always use Lego Duplos to make a vase, to make life somewhat 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 purpose 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 know-how. The measurement system makes use of a frequency of 70 MHz, which minimises interference because of salinity. The second sensor detects the extent of water current, offering a corresponding voltage worth on an analogue pin; it offers 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 have to be calculated, that are then imported into the ultimate program; the routine for calculating the humidity utilizing the liquid degree 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 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 are able to check 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 offered 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 means of the interface offered by a selected protect.
These are 4 utility examples to be thought-about as workout routines through which we’ve tried to point out you tips on how to use as many circuit components as attainable, additionally explaining tips on how to write firmware to implement the administration by means of the Arduino Uno board.
In fact, on the premise of what has been defined, every of you may develop purposes as you see match.
Even earlier than the looks of academic units such because the ARDULEGOKIT, it was tough, to say the least, to restrict your creativeness when utilizing LEGO bricks. Now, due to the chances of this package, whether or not you’re an skilled or a newbie on the planet of electronics and programming, you may lastly say goodbye to the bounds of your creativeness and have enjoyable with LEGO and its developments.
FROM OPENSTORE
ARDULEGOKIT
Sumber : ARDULEGO KIT: create with Lego and Arduino – Open Electronics