top of page

Search Results

125 items found for ""

  • Arduino_DIGITAL_IO | SimpleMechatronics| Simple MECHATRONICSsimple mechatronics

    Introduction to Arduino Digital I/O The most common and highly used data transfer, from and to (Input and Output) the micro-controller is DIGITAL. Digital data means, signal is set at either logic HIGH (i.e. 5V or 3.3V or Vcc) or logic LOW ( i.e., ground or 0V) Most of the times Digital signal may not exactly matching to the Vcc voltage and Ground voltage. So, the voltage at a trigger voltage level is considered as High or Low. The Trigger voltage is dependent on the micro-controller, in use. Normally, for 5V power supplies, above 3.5V is considered as logic High and less than 2V is considered as logic Low. (This may vary slightly and depends on the micro-controller). Another important point to note is, the micro-controller cannot handle high currents. Any micro-controller generates current in milli-amperes only. So, a series resistance to the load, must be connected wherever is required, to limit the current flowing through the micro-controller pin. Understanding Digital Output : A test circuit is to be connected as shown in the figure, using 4 LEDs and 4 resistors , on a bread board. ​ Here, they are connected to four pins of Arduino Nano, i.e. D2, D3, D4 and D5, for testing. You may connect any number of LEDs, to any pins of Arduino Nano (of your choice). Then, Connect the USB cable (USB type-A and micro-USB on either end) to the Arduino Nano and your system USB port. Now, Open Arduino IDE, then select through menu, File->New . Then declare all the LED connected pins, as output in setup function, using pinMode function, as shown below. ​ void setup() { // put your setup code here, to run once: pinMode ( 2 , OUTPUT ); pinMode ( 3 , OUTPUT ); pinMode ( 4 , OUTPUT ); pinMode ( 5 , OUTPUT ); } } Then, send logic High and Low codes to each pin sequentially, to all the LED connected pins, using digitalWrite function (HIGH to glow and LOW to off), with a small delay, as shown below. ​ void loop() { // put your main code here, to run repeatedly: digitalWrite ( 2 , HIGH ); delay(1000); digitalWrite ( 2 , LOW ); ​ digitalWrite ( 3 , HIGH ); delay(1000); digitalWrite ( 3 , LOW ); digitalWrite ( 4 , HIGH ); delay(1000); digitalWrite ( 4 , LOW ); ​ digitalWrite ( 5 , HIGH ); delay(1000); digitalWrite ( 5 , LOW ); } ​ The above code is written for easy understanding. You may use for loop, instead of writing code for each pin, which is shown in the next part (Understanding Digital Input). ​ Then, through menu, do necessary settings for connecting Arduino Nano: Tools->Board->Arduino Nano Tools->Programmer-.USBasp Tools->Port->(select the port connected to Arduino Nano) ​ Then, press compile icon (or through menu, sketch->Verify/Compile) and check for any errors uin typing. Then, press upload icon (or through menu, sketch->upload) and check the RX & TX LEDs on Arduino Nano are blinking, while uploading the sketch. ​ Once uploaded the sketch to Arduino Nano, the LEDs starts glowing one-by-one sequentially for one second each. Since, it was written in loop function, the sequence continues. Understanding Digital Input : The previous test circuit is to be modified as shown in the above figure, by adding a positive probe ( red ) connected to 5V and a negative probe ( blue ) connected to GND (ground). You may connect berg strip pins to A2, A3, A4 and A5 , for easy identification as input pins. ​ Now, in the setup function, set the pins 2 to 5 as Digital OUTPUT , using pinMode function as earlier (same code is modified using for loop). Also, set the A2, A3, A4 and A5 pins as Digital INPUT , using pinMode function, as shown below. ​ void setup() { // put your setup code here, to run once: int i; //variable declaration for ( int i=2; i<=5; i++ ) //for loop to select 2 to 5 pinMode ( i , OUTPUT ); // set 2 to 5 as OUTPUT ​ // set A 2 to A5 as INPUT pinMode ( A2 , INPUT ); pinMode ( A3 , INPUT ); pinMode ( A4 , INPUT ); pinMode ( A5 , INPUT ); } ​ Then, send logic High and Low codes to respective output pins (2, 3, 4 and 5), according to the status of input pins (A2, A3, A4 and A5). Here, digitalRead function is used to read the digital status (HIGH or LOW ) of each input pin. Where as digitalWrite function (HIGH or LOW ), is used to send output code to the respective pins. You may observe in the loop function, four types of logic is used to show the status of input pins to respective output pins. ​ void loop() { // put your main code here, to run repeatedly: bool pin2, pin3; // 1) read the input and act accordingly if it is HIGH pin2 = digitalRead( A2 ); if ( pin2 == HIGH ) digitalWrite ( 2 , HIGH ); else digitalWrite ( 2 , LOW ); // 2) read the input and act accordingly if it is LOW pin3 = digitalRead( A3 ); if ( pin3 == LOW ) digitalWrite ( 3 , LOW ); else digitalWrite ( 3 , HIGH ); // 3) read the input and directly act accordingly if ( digitalRead ( A4 ) ) digitalWrite ( 4 , HIGH ); else digitalWrite ( 4 , LOW ); // 4) set output matches to the input value; single statement digitalWrite ( 5 , digitalRead ( A5 ) ); } ​ Again compile and upload the sketch to Arduino Nano. Then, test the sketch using the circuit. The LED connected to pin 2 glows, when A2 pin is connected to positive probe and goes off, when the A2 pin is connected to negative probe. The same phenomenon is observed with input pin A3 to output pin 3, input pin A4 to output pin 4 and A5 to 5. ​ As the input pins are neither connected to positive nor negative power supply, by default, the A2 to A5 are in floating condition and sensitive to small signal change. Some times, some inputs may be set to either HIGH or LOW status, if not connected to any probe. External Pull-up/ Pull-down to Digital Input(s) : To avoid floating state for digital input(s), the open input(s) should be connected to either positive (5V) or negative (GND) of power supply, through resistors, by default. Now, test the output, using the probe connecting to the input pins for both the Pull-up and Pull-down circuits, which is shown above. In case, the inputs are continuously connected to any external signalling system, then there is no need of pull-up or pull-down resistors. No change is required in the sketch to test the external pull-up or pull-down circuit. Activating Internal Pull-up Resistor(s) to Digital Input(s) : While using external pull-up or pull-down resistor(s) for digital inputs, the resistor(s) have to be tied to either positive or negative power supply. To avoid using any internal resistor, the pull-up resistor(s) may be activated inside the micro-controller, through writing code in the sketch, as shown below. ​ pinMode ( x_pin_number , INPUT ); // set any pin as input digitalWrite ( x_pin_number , OUTPUT ); // activates internal pull-up resistor ​ Now, in the setup function, set the pins A2 to A5 as Digital INPUT , using pinMode function as earlier, and then add digitalWrite function as OUTPUT , as shown below. ​ void setup() { // put your setup code here, to run once: int i; //variable declaration for ( int i=2; i<=5; i++ ) //for loop to select 2 to 5 pinMode ( i , OUTPUT ); // set 2 to 5 as OUTPUT ​ // set A 2 to A5 as INPUT pinMode ( A2 , INPUT ); pinMode ( A3 , INPUT ); pinMode ( A4 , INPUT ); pinMode ( A5 , INPUT ); ​ // activate internal pull-up resistor for A 2 to A5 digitalWrite ( A2 , OUTPUT ); digitalWrite ( A3 , OUTPUT ); digitalWrite ( A4 , OUTPUT ); digitalWrite ( A5 , OUTPUT ); } ​ There is no change in loop function. compile and upload again. Since, the inputs are pulled-up internally (means connected to positive through resistors), all the LEDs glow, by default. Now, connect each input pin to ground to observe the respective LED goes to OFF state. ​ So, this will avoid using resistor(s) and makes the circuit neat. In case the outputs are to be in the off state, by default, you may change the logic in the loop function or may use pull-down resistors as shown in the earlier circuit. ​ Best of Luck.

  • mcuAdcDac | SimpleMechatronics| Simple MECHATRONICSsimple mechatronics

    microcontroller - ADC & DAC One of the common and important feature available with microcontrollers is ADC ( Analog to Digital Conversion ) . Where as DAC (Digital to Analog Conversion) is available in selected micro-controllers only. ​ Most of the data aquisition systems and data displaying sytems use the ADC feature of the micro-controller to convert external data voltage level or signals to digital format. The digital data thus obtained may be displayed suitably or recorded or transmitted to main processing unit. ​ On the other hand, DAC is used to convert Digital data into a wave form generation or required signal generation etc. The Digital Video or Audio signals will be converted to analog signals in mobiles, televisions etc. Effectiveness and control of ADC / DAC in micro-controllers: All the control of ADC/DAC are controlled through the specific registers in mocro-controller, which holds transmission data, control system like, speed, accuracy, channel number etc. The exact register control is dependent on the micro-controller selected for the purpose. So, you should select the micro-controller, which exactly suits your ADC/DAC requirements of the project. Resolution is the one of the important feature to be noted for a micro-controller. Most of the micro-controllers support 8bit (0-255), 10bit (0-1023) and 12bit(0-4095) resolution. It means the micro-controller can convert ADC / DAC to upto 8 or 10 or 12 bits resolution. So, if you need to convert an anolog signal to 10 bit digital resolution, then 8 bit is not suitable. You have to select atleast 10 bit resolution ADC/DAC supported micro-controller. Speed is the another important feature to be considered for ADC/DAC. High speed of conversion makes more samples per second and can generate accurate signal input status as well as can convert signals for higher frequencies. So, select the micro-controller which matches your sampling rate and frequency requirements. Accuracy is of conversion is also one of the feature to be noted for a micro-controller. Most of the micro-controllers lost accuracy at higher speed of conversions. Due to loss of accuracy the exact data input or output analysis may effected and overall performance of the data aquisition or wave form may be effected. Number of Channels is also to be considered as per the requirement of the project. Some times, more data aquisition channels or more varieties of wave form outputs may be needed. So, you have to select the suitable micro-controller which supports the channels required for the project. SUMMARY: ​ So, for ADC/DAC requirement, select the micro controller which supports all the features as required for the project w.r.t. cost and purpose of the project. ​ Say, You may require to convert an analog signal from remote area to digital format and transmit to a central processing unit. Then select micro-controller which has required ADC features discussed above and data trasmitting features as well. ENJOY. GOOD LUCK TO YOU.

  • ServoCodeLock | SimpleMechatronics| Simple MECHATRONICSsimple mechatronics

    Servo (3digit) Code Lock The Servo code lock is used to open and close a door or latch, using a servo motor. The circuit presented here is very simple and occupies very less space (small PCB size and small display due to OLED) and operates on 8 pin microcontroller ATtiny85, which is easily available and programmable using any AVR programmer. ​ ATTINY85 is eight pin Micro-controller sufficiently powerful for the project, with 8KB flash + 512B RAM + 512B EEPROM and 1MHz default clock frequency, is heart of the system. OLED display is small display of 0.96” size, 5VDC supply, I2C connector, with 128x64 pixel resolution. It has 4 pins, out of which 2 for power supply, 1 for serial data (SDA pin) and 1 for the clock (SCL pin). The display has 128x64 pixel resolution. The text is displayed using 16X8 bit font size and the code numbers are displayed using 32x24 bit (big) font size. ​ Working Concept/Description: ATtiny85 is 8 pin microcontroller, is the heart of the project. A three digit code is to be saved initially in the EEPROM of the MCU and the lock will be opened when the same code is entered next time onwards to operate the servo. The code for the lock operation is permanently saved in the EEPROM of the micro-controller and it is available even after removing the power supply. The circuit and its operation is shown on a single PCB, but for practical use, only the two switches and the OLED should be accessible to the user. Proper push-pull arrangement for the door lock / latch, should be made and connected to the horn of the servo. ​ The ATTINY85 micro-controller, continuously reads the inputs from the two button switches and displays the same on the OLED. The switches SW_NEXT and SW_UP are provided to enter the code. SW_UP is for changing the numbers from 1 to 9 sequentially of each digit. SW_NEXT is for selecting next digit of the display. Once third digit is selected and pressed SW_NEXT again, the ATTINY85 starts processing the entered code. Only one out of three digits is visible and editable at any point of time. The remaining two digits are covered with a rectangular character. Any code between 112 to 999 are valid. A 5VDC power supply is delivered by IC 7805 from 9V battery here. But, any type of 7VDC to 12VDC (250mA or above) power supply may be connected. ​ Full circuit-diagram is available below: ​Initial Setup and Usage: After assembling the circuit on a PCB, connect DC power supply (9V battery) to the board and switch ON the power switch SW_POWER. Then load/burn the ServoCodeLock.hex file to the Micro-controller (ATTINY85) using AVR programmer. Now, for the first time usage, the display shows a message “NEW CHIP OR NO CODE” and waits for entering “NEW CODE:”. By pressing SW_NEXT and SW_UP switches, a new code (except 111) can be saved on to the EEPROM of the Micro-controller ATTINY85. To use the code lock, the display shows “ENTER CODE:” to receive the code for unlocking or turning the Servo. By pressing switches SW_NEXT and SW_UP, select a three digit code. If the code matches with the saved code, then the display shows “SUCCESSFUL; LOCK OPEN.SERVO ON” message and the servo motor rotates the horn for opening the latch connected to it, if any. The Servo connected pin (5) sets high for a prescribed time ( about 10 seconds here ) and switches OFF after the specified delay. Again, the system waits for the input. If the code does not match with the saved code, the display shows “INVAID CODE; LOCK CLOSED.SERVO OFF” message and the loop continues for the next input. CODING: The code is developed using C language and compiled using AVR studio 4. The code may be uploaded/ written to ATTINY85 microcontroller (MCU) using any AVR programmer through ISP port as shown in the circuit. All the Variables and functions are named for easy identification of purpose and two font libraries are supported for small and big fonts to display on the OLED. The delay required to keep the door open by relay is defined initially in the ServoCodeLock.C file as, #define RELAY_DELAY 10000 // 10 SECONDS, vary if required So, the value may be varied as per requirement and recompile using AVRstudio4 (or next version) and upload to ATTINY85. To change or erase, the saved code from EEPROM of MCU, use AVR programmer to re-load the program as explained above. List of required Components: MCU-ATTINY85 (8 pin) -1no OLED-128x64 pixels (I2C;4PIN;5V supply) -1no Push buttons – 2nos Slide switch – 1 no 8 pin IC base – 1no Berg strip-female(4pins for OLED) – 1no Berg strip-male(6pins) for programming – 1no 10k Resistance (1/4 watt) – 1nos. 2K2 resistance (1/4 watt) – 1no LED-5mm – 1no Servo Motor (5V) – 1 no IC 7805 – 1no 1N4007 diode – 2nos 10uF;25V capacitors – 2nos 0.1uF disc capacitor – 1no 9V Battery clip 9V battery. Suitable (sized) PCB latch, links etc ​Good luck. Have a nice day. click the link / attachment to download the file and rename as ServoCodeLock.HEX , then upload to ATTINY85 using any suitable AVR programmer. ServoCodeLock.HEX For source code (in C-language), (ServoCodeLock.C) please send message through contact form . The code will be sent to your e-mail. Learning is not the product of teaching. Learning is the product of the activity of learners. - John Holt

  • SafeCurrentGuard | SimpleMechatronics| Simple MECHATRONICSsimple mechatronics

    Safe Current Appliance Guard Safe Current Appliance Guard is useful to protect your electrical / electronics equipment / appliance / gadget from over current flow through them. The circuit can display current flow value and guard both AC and DC appliances, when the current flow them exceeds more than trip value set by you. ATTINY84 is used for the project, which is the heart of the circuit to read the current value and trip the relay in case the current flow is more than trip value, for more than one second, which is set by the user. The ADC system of the ATTINY84, continuously reads the voltage (or signal) generated by ACS 712 (hall effect) current sensor. Then the ADC value is multiplied with ACS_MF, and displays as READ CURRENT on the OLED. Before reading AC or DC current flow, the RELAY is switched ON through a transistor. Then, the ADC value is read 25 times continuously with one milli-second interval and records the peak ADC value (out of 25 samples), so that peak value of at least one full wave can be read for 50 Hz or 60Hz AC current. If the peak values, thus read, is exceeding more than three times consecutively (approximately 1.3 seconds), then the ATTINY84 switches off the relay (through transistor). ​ The full circuit diagram is available below: INITIAL SETUP: ​ Once the circuit is ready on general purpose (vero board is preferred) PCB, connect DC power supply (9V battery), then connect AVR programmer to ISP port of ATTINY84 and write/burn SafeCurrentGuard.HEX file to the micro controller. The program displays the title of the project, then displays the READ CURRENT and TRIP CURRENT values on the OLED. To set TRIP value, press SW_UP or SW_DN button. Then the OLED displays the existing Trip value. Now, you may press SW_UP or SW_DN button to increase or decrease the Trip value respectively. If, no input is found from the SW_UP or SW_DN buttons for more than 5 seconds, then the displayed value (new value) is saved to EEPROM and the Trip value is available after switch off the circuit also. ​ To calibrate the READ CURRENT value, connect an DC Ammeter or multi-meter, in current mode (10A or more), in series as shown here. Now, Restart the circuit and observe the difference in READ CURRENT value and multi-meter value in amperes. If, the value is different, then note down the percentage of error. Now, press SW_RST to restart the circuit. While displaying the Title of the project on OLED, press and hold SW_UP or SW_DN button until the current multiplication factor is displayed on the OLED screen. Now, adjust the displayed value to suit the error percentage noted earlier. Increase the multiplication value, if the READ CURRENT is low and vice-versa. The value will be saved to EEPROM, once no button is pressed for more than 5 seconds. Now, compare the READ CURRENT w.r.t. to multi-meter value and adjust the multiplication factor, till the READ CURRENT matches to the multi-meter value. Once calibrated, remove the multi-meter and reset the circuit as shown above. Now, your circuit is ready to use. If, you have no need to change the values, i.e., once calibrated and trip current value is set, then the OLED, SW_UP and SW_DN buttons may be permanently disconnected (or removed). WORKING: ​ Once calibrated and set the trip current value, then connect the actual load, in series as shown in the circuit. Then, power-on the circuit, using any conventional 12VDC power supply (using transformer) or 12VDC SMPS. The Title is displayed on OLED, then Relay is set to ON mode and continuously displays the current flow through the load, which is indicated by slow blinking of LED2 . If, at any time, the current flowing through the load exceeds the set trip value for more than one second, then the relay is set to OFF mode, the trp message is displayed and the LED2 blinks quickly. ​ You may press SW_RST to restart / reset the circuit. The LED1 indicates the presence of DC power supply. The LED3 is complementary (opposite state) to relay status. You may use this output to generate alarm using piezo-buzzer etc. ​ ​ Use shorting jumper in J1 mode, if the relay is operating on 5V and the input DC power supply may be 8VDC to 12VDC. Set in J2 mode, if the relay selected is operating on 12V and input DC power supply should be 12VDC. The current sensor ACS-712 is normally available in 5A or 20A or 30A capacities. Select the capacity/module as per the load requirement. The thick line shown in the circuit should carry the flowing current through the load. The multiplication factor depends on the capacity of ACS-712, which can be adjusted using the SW_UP and SW_DN as explained in calibration method. ​ The theoretical value of multiplication factor for 5A module is 264, for 20A module is 488 and for 30A module is 740. click the link / attachment to download the file and rename as SafeCurrentGuard.HEX , then upload to ATTINY84 using any suitable AVR programmer. SafeCurrentGuard.HEX For source code (in C-language), (SafeCurrentGuard.C) please send message through contact form . The code will be sent to your e-mail.

  • 4 IR Remote Control

    Small Robot : 4 IR Remote Control # . < < < Previous List All Next > > > . Introduction Another way to control the Small Robot is, using an IR (infra Red) remote. Here, a handy remote with direction markings is selected for controlling the Small Robot. The IR remote sends a specific pattern of digital signal through its IR LED, based on the button press. An IR receiver module (TSOP 1738) receives the IR signal from the IR remote and sends to the micro-controller (ATTINY13). Then, the micro-controller decodes the signal and converts it to 4 bit binary code, which is available as D0,D1,D2 & D3 at 6 pin connector. Then, the 4 bit code is received by the motor driver IC (L293D) on the Base Frame, to drive the two B.O. motors accordingly. (refer Small-Robot Base Frame for motor control codes) A small 8 pin micro-controller (ATTINY13) is used in Receiver circuit. As the transmitter is IR remote, so there is no need of Transmitter board and micro-controller. Any IR remote may be used to control the Small Robot. But, the signal generated by the IR remote should be decoded and then it shall be converted to, required 4 bit binary code, to control the Small Robot. Similarly, any IR receiver with 38KHz carrier frequency may be used, like TSOP1838, TSOP98138, TSOP38328, TSPO38438 etc. The pinouts should match with the circuit. IR (Infra Red) Transmitter: The IR remote used in the project is clone to Panasonic Audio remote control, which is easily available at affordable price (The original Panasonic remote is costly and not advisable for our project). The main advantage with this IR remote is, it has the four direction keys on a handy size. The front two buttons used for volume control are used to rotate the Small Robot in Clockwise and Counter-Clockwise directions. Most of the IR remotes use 38 KHz carrier frequency. It means, the IR LED of the remote glows on/off for 38000 times per second, which is called as Carrier Frequency. Again, the time of 38 KHz IR LED frequency varies for code generation. Say, to send a digital code '1' , the 38 KHz frequency is available for more time, compared to send code '0', before stopping the Carrier Frequency. So, a specific pattern of digital code is sent by the IR remote, on each key press. To differentiate or identify the IR code from each IR remote manufacturer, a header code is sent initially and the digital time also varies. (The header code ignored in our case). IR (Infra Red) Receiver: In the IR Receiver Board, the IR receiver, TSOP1738, is used, for easy identification of its pin-outs. One of its pin, out of 4 pins, is absent, which makes the pin identification fool proof. (Refer the circuit diagram below for better understanding). So, the Infra-red signals received by the IR receiver, TSOP1738, filters the Carrier Frequency and sends the digital code to the micro-controller (ATTINY13). An LED is provided to show the status of data reception from the IR receiver. The micro-controller decodes the received data, and converts to four bit parallel data. Then the four bits are sent to the base frame through the 6 pin connector, which in turn controls the movement of the Small Robot. In case, to use different remote, the IR pattern has to be studied and the Source code is to be modified accordingly (modify the getIRcode() function as required). The 5VDC power supply for Receiver board is derived from the Main board of Base Frame, through 6 pin connector. Good Luck Download IR HEX file Contact for Source Code Download file from above link and remove .TXT extension. . < < < Previous Once Small Robot's Base Frame is made, then, various control systems for Small Robot are developed and available for selection, using 'Previous ' and 'Next ' buttons here. Next > > > .

  • Arduino_IDE | SimpleMechatronics| Simple MECHATRONICSsimple mechatronics

    INTRODUCTION to Arduino IDE : The IDE (Integrated Development Environment) is open-source software, easy to install, user friendly and all-in-one package available on-line. You may write your code and upload it to the Arduino board. You are able use some basic codes as examples also, which makes you comfortable while writing code. The Arduino code is normally known as Arduino Sketch. DOWNLOADING Arduino IDE : You may download the IDE package from the official website at following link (courtesy Arduino.cc): https://www.arduino.cc/en/software Once you click the above link, the following page will appear on your screen, which will allow you to download the programming IDE for Arduino to match your Operating System. Select matching Operating System from the screen and download the IDE. Once you complete the download, then Install the software on your computer / laptop. This will take some time and follow the on screen instructions. After successful completion of the Software, a short-cut is available on your system desktop with the logo as shown here. USING Arduino IDE : Now, click the Arduino shortcut. Then the Arduino IDE screen appears on the monitor as shown below. In the above over-lapped screen, the important things to be noted are marked in red coloured rectangle. 1) At the top-left corner of overall screen displays, Filename and Arduino Version 2) The File name also appears on the top-left corner of white screen. 3) At the bottom-right corner of screen displays, setting of Arduino Board and connected Port [or default settings] 4) void setup ( ) is the function/method initially called (means used by the micro-controller) once the Arduino is powered on. So, this function/method is used to write the required code for setting Input/Output/Communication/Display etc. 5) void loop ( ) is called next to the setup function. Once the statements / coding is executed to the end of the loop function/method, then the micro-controller continues to execute statements of the loop function from the starting. So, the statements (or code) written in loop function/method is called repeatedly, infinite times. So, this function/method is used to read or monitor external variables as input and process them to output the signals accordingly. Using Arduino EXAMPLES : The main advantage with Arduino is, EXAMPLE CODES are available for easy understanding of coding and managing syntax while writing the code. Most of the Arduino programmers go through the related example before writing their actual required code. You may copy required coding lines from examples and paste in your code to save time and reduce syntax errors. ​ To select an example, click following menus/sub-menus in the order as, File -> Examples -> Required Subject -> Required Topic. Then click on the required topic. The example code appears on the screen as shown below: ​ COMPILING Arduino Sketch : Compiling means, checking the code (sketch) written by you for all types of errors, like typographic errors, syntax errors, errors in assigning and using variables etc., except Run-Time errors. ​ Before, compiling the sketch, you have to select the type of Arduino board to upload the code. To select the Arduino board, click the menu/menu items as, Tools -> Board -> Select the Target Board from the list A model Arduino board selection is shown below: To compile the sketch, you may click TICK mark on the top-left corner of IDE (below menu name File), or you may click the menu/menu item Sketch -> Verfy/Compile . ​ After compiling the sketch, the IDE displays the status of the compilation at the bottom of the screen (in black coloured box). The message contains the details of types of memory usage on successful compilation. In case of errors are found in the sketch, the details of the errors are shown. ​ The following model screens shows the compilation messages on SUCCESS and ERRORS successively If the compilation is successful, then you may upload the sketch to your Arduino board. In case, there are errors displayed, then the errors should be cleared one-by-one. A red band is displayed on the coding screen (editing pane) and error text in red colour is displayed on output screen (black pane). UPLOADING Arduino Sketch : Once compiling is successful, the code (sketch) may be uploaded to the Arduino board. To upload the sketch, the target Arduino board has to be connected to your system (PC/laptop). Then select the Port from menu/menu items as Tools -> Port (shows default) -> Select the Port Number connected to Arduino board ​ Then, set the Programmer as required. Use AVRISP MkII [by default] or AVRISP for most of the Arduion boards, unless you are using a specific type of Arduino board / programmer. You may set the programmer menu/menu items as, Tools -> Programmer -> Select the programmer from the list ​ You may test the connection through menu/menu items as, Tools -> Get Board Info The IDE reads the Arduino board information and displays the details of the Arduino board, if the port connection is correctly set. A model Arduino Port selection and testing with reading information are shown below: On completion of settings as explained above, you may click ARROW mark on the top-left corner of IDE (below menu name Edit), or you may click the menu/menu item Sketch -> Upload . Then, a progress bar is displayed below editor screen on right side and "Uploading..." message is displayed on left side. ​ If the sketch is uploaded successfully to the Arduino board, then the "Done. Uploading" message and memory details are displayed on output screen (bottom black pane). In case, there are error(s) while uploading the sketch to the Arduino board, then the error(s) are displayed on output screen (black pane) in red coloured text. Check / study the error(s) and check the connection once again, the re-upload the sketch. NONE can distroy iron, but its own rust can! Likewise, none can destroy a PERSON, but own mindset can. – Dr. Ratan Tata

  • 3 AC SUPPLY

    < Previous Next > In the AC ( Alternating Current ) power supply, the direction of current flow changes periodically (for every fixed time length). For example, the current flow is in opposite direction, for every 1/100th second, for 50 Hz and 1/120th second, for 60 Hz power supplies. The power supply waveforms are sinusoidal in general and the model sinusoidal wave form (also called as sine wave) is shown here. Why AC ? Easy and convenient Power Transmission for long distances. For the AC power supply, the voltages may be easily stepped-up or stepped-down, also economically, using transformer, which requires complex circuits for DC power supply. AC generators are simpler in construction and maintenance than DC generators. Rotating magnetic field, which is required for motors, can be easily generated with AC power supply, compared to DC power supply. This simplifies construction of motors. Conversion process of AC to DC is simpler, which requires only rectifiers. Whereas conversion of DC to AC requires complex circuit(s). 110V or 220V ? Some countries distribute 110V AC with 60Hz, whereas other countries distribute 220V AC with 50Hz, as power supply to houses and industries. As the voltage increases, the severity of electric shock increases and more dangerous when touched to the live wire(s). Our body resistance reduces with skin wetness. So, most of the cold counties adopt 110VAC to reduce the risk of electric shock at higher voltage. For the same power requirement, for higher voltage, less current is consumed, whereas for lower voltage, higher current is consumed. The cross-section of wire requirement depends on quantity of current flow, which is directly proportional to it. So, for 110V power supply, the wire diameter is more (almost double cross-section), when compared to 220V power supply, for the same power requirement. What is RMS ? In the DC power supply, the Voltage or Current can be directly indicated, since the DC power supply is steady. Whereas in AC power supply, the Voltage or Current is periodically reversed. So, we can measure only Peak values, with special measuring equipment(s). So, in AC circuits, RMS values are used for measurement. The word RMS stands for Root Mean Square value. The RMS value shall be applied to Alternating Current or Alternating Voltage in AC power supplies only. For example, the RMS value of AC is equivalent to actual DC value. i.e., the power generated or power consumed using a DC power supply is equal to RMS AC power supply. So, RMS value is always less than the Peak value (Voltage or Current). Most of the electronic circuits does not require mains AC power supply as power source. Some circuits control the mains operated appliances, like motors, lighting system etc. Touching the mains supply is dangerous and lethal. So, care should be taken, while working on mains power supply.

  • 7 Path Follower

    Small Robot : 7 Path Follower # . < < < Previous List All Next > > > . Introduction: A Path Follower is self controlled Robot, which follows in a path, which is a wide white or black line. The width of the path is generally more than the width of the Robot. Like Line Follower, here also, many types of sensors may be used to read the path. The Small Robot uses IR (Infra-Red) sensors, to read the path. Four pairs of IR LEDs and IR sensors (shaped as LED) are used here to read the Path. All the four IR sensing pairs are arranged in a row, perpendicular to the path, two on each side of the Small Robot. The Small Robot always try to position within the path, by following the edge of the path. To read four input pins for IR sensors, ATTNY84 micro-controller is selected, which have 14 pins. Out of 14 pins, four pins are used for sensing the line and four pins are required to control the two motors, through the motor driver (L293D). (refer Small Robot Base Frame for motor control codes). In general, Path Followers are used in industries for material handling. The robot moves within the two lines earmarked for its movement. The programming is to move the Robot within two thick lines, which forms as a path, which may have sharp and smooth curves. The Small Robot is programmed here to follow various path shapes, like sharp bends, sharp turns, sharp curves etc. The coding may be modified for individuals requirement. A model path used to test the Small Robot is shown below, having various line shapes. About Path Sensing: The Path Follower uses IR (Infra-red) sensing system to read the presence of Path. An IR LED emits IR light on the bottom surface. The IR light reflects from the surface and falls on an IR sensor (in LED shape), placed near to the IR LED. The IR sensor is connected in reverse biased, which varies its internal resistance, depending on the brightness of reflected IR light. The internal resistance of the IR sensor decreases with increase in falling IR light. So, when the surface below the IR sensor is white, more reflected light falls on the IR sensor, which makes least internal resistance. Similarly, if the surface is black, least light reflects on the IR sensor, which makes highest internal resistance. Due to change in the resistance of IR sensor, the voltage at the junction of the IR sensor and fixed resistance varies, which are connected in series with power supply and ground. A typical IR LED + IR sensor pair arrangement with the circuit diagram is shown below. Total four such IR sensing pairs are required for Path Following Small Robot, and soldered on a PCB, then fixed in front of the Small Robot. All the IR LEDs and IR sensors are 3 mm size. Maintain the gap between. the two successive IR sensors at each extreme end should be just less than the line width of the path. The distance between the mid of the two extreme IR sensors shall be approximately equal to the width of the path. So, that, the Path Follower tries to keep the itself within the path. The IR sensor PCB, with 4 IR pairs, shall be fitted in front of the Small Robot, as shown below, with a clearance adjustment arrangement (from surface) , to adjust the sensitivity with black and white surfaces. Working of Path Follower: Making of Small Robot as Path Follower is simple and easy. One PCB is required for IR sensing board, with 4 pairs of IR LEDs and IR sensors explained above. Another PCB with micro-controller ATTINY84 is used as control system for the Path Follower based on the varying voltages obtained from four IR sensors. The varying voltages from the IR sensor board are read as four digital inputs by the micro-controller. Then, the programmed logic makes the Small Robot to follow middle two IR sensor. In case, the Small Robot reads that, any IR sensor is out of path, the required output code is sent through the four motor control pins, to turn the Small Robot accordingly, else Small Robot moves in straight path. Similarly, in case of sharp turns, smooth turns, the Small Robot turns accordingly. The complete circuit diagram of Control Board with ATTINY84, is available below. Use jumper wires to connect S1, S2, S3 & S4 pins from Sensor Board to Control board consecutively. The shorting jumper, J1 is provided to select the path colour as BLACK or WHITE. Either Red or Yellow LED glows by selecting the shorting jumper position, for White or Black path. A button switch, SW1 on control board, is useful to start the Path Follower, after switching ON the power supply to the Control Board. Best of Luck Download PF HEX file Contact for Source Code Download file from above link and remove .TXT extension. . < < < Previous Once Small Robot's Base Frame is made, then, various control systems for Small Robot are developed and available for selection, using 'Previous ' and 'Next ' buttons here. Next > > > .

  • 2 IR based Line Follower

    Slim-Bot 2 IR based Line Follower Introduction .. As the name indicates, SLIM-BOT, is a small, simple, compact robot, which may be moved or controlled using various inputs, without using any micro-controller. There is no need of programming language or coding to make and control the Slim-Bot. This is the basic project for those, who don’t have any knowledge in micro-controllers and programming. The various controls for the Slim-Bot is completely based on the electronic circuits only. To make IR line follower, two sets of, IR (Infra-Red) light emitting LEDs (known as IR-LEDs) and IR sensing LEDs (known as IR sensor LEDs) are used on either side of a line, fitted on the front side of slim-bot. The signal generated by the IR sensor LEDs, based on the presence of the line, is fed to the two digital inputs of the 8 pin berg strip. The Slim-bot moves forward or takes turn accordingly to move itself on the line. About Infra Red Sensing: To make the slim-bot compact, two numbers of small IR sensor boards are made for reading the presence of the line. Each IR sensor board contains, an IR-LED and an IR sensor LED, which are positioned side-by-side on a small PCB. Two series resistors and connectors are used for each IR sensor board. The complete circuit diagram of IR sensor board and actual IR sensor board with IR-LED and IR sensor LED arrangement, are shown below. Similar IR sensor boards are readily available in the market, with sensitivity adjustment, may be used in the project. But, they are little bigger in size. When, the IR sensor board is connected to power supply (here it is 3.7VDC), then the IR-LED glows, which emits IR (Infra-Red) light. As the IR light is invisible to naked eye, you may use any digital camera (or mobile phone camera), to check the working of IR-LED. When the IR light is reflected back from a surface (on white surface), the resistance of IR sensor LED is decreased and the voltage at signal junction increases. About Line Follower: Two such IR sensor boards are fitted on either side, in front of the slim-bot. The circuit diagram, connecting the two IR sensor boards to the 8 pin berg strip on base board, is shown below. When, an IR sensor LED gets high signal, due to white surface (reflected IR light from IR-LED), then the motor on the same side rotates . Similarly, when the IR sensor LED gets low signal, due to black surface (insufficient reflected light from IR-LED from black surface), then the motor on the same side stops rotation. So, the motor on white surface side rotates in forward direction and the motor on black surface side (line is drawn in black colour) stops rotation. Thus, making the slim-bot to re-position on the line. When both the IR sensors are on white surface, the slim-bot moves straight forward, continuously. CLICK HERE to know, how to make BASE for SLIM-BOT.

  • Satellite_Clock | SimpleMechatronics| Simple MECHATRONICSsimple mechatronics

    Satellite CLOCK Normally, RTC (Real Time Clock) ICs are used for time display which are easily available and reasonably accurate. But, the accuracy of RTC, highly depends on the seasonal / atmospheric temperature, which effects the performance of the crystal used in the RTC circuit. So, to have more accurate time, which is independent of temperature change, the Satellite Clock reads the data delivered from GPS ( Geographic Positioning System) satellites and displays in required format, which is highly accurate . NEO-6M module: NEO-6M, a GPS receiver module, used to receive NMEA (National Marine Electronics Association ) data continuously from GPS satellite(s). The data is transimtted through its TX pin (Serial data at 9600 baud rate, by default). A sample data from GPS receiver is shown below. The Arduino processes the data and picks the time stamp (marked using red colour line) in the received data string. TM1637 module: The TM1637 module has 4 digits of seven segment display, with a colon between 2nd and 3rd digits, which is suitable for clock display system. The IC behind the module receives the data using TWI (Two Wire Interface / IIC) and continuously refreshes the 4 digits. By using this module, only two pins of micro-controller (or Arduino) is sufficient for interfacing. The TM1637 module has brightness control of the display and may be changed as required. The basic working of the circuit is, the data received by the GPS receiver module, NEO-6M, is transmitted to Arduino Uno's RX pin (of Serial port). The Arduino Uno processes the data and picks the TIME stamp , by identifying the keyword GPGGA (or you may use GPRMC ) in the received data string. Then, the time string is processed to show on TM1637 module, in UTC (Universal Time Coordinated) format (default format received by the GPS satellite) or Local time format (12 hour / 24 hour) as per jumper settings. ​ Refer full circuit diagram: INITIAL SETUP / TESTING: The circuit is assembled on a general purpose PCB and connected the pins of Arduino Uno using berg strip (refer Video) . Compile and upload SatClock.ino to Arduino Uno, using Arduino IDE. To avoid conflict with GPS data at RX pin of Arduino, while uploading sketch, the GPS module should be connected after uploading the sketch. ​ Once uploaded the sketch to Arduino Uno, all the segements of display module and two LEDs glow for a while as self-test. Then, it shows 1637 number and enters the loop to receive the code from GPS module. For first time use ( or connected after long time ), it takes much time to connect to satellite, to display the time. ​ To know the status / error, two types of indications are programmed in the sketch. 1) single moving horizontal line indicates, that the GPS module is absent or NO data is received from GPS module. 2) three moving horizontal lines indicate, that data is received from GPS, but not in the specified format or time stamp is invalid. ​ Once, valid data is received (means time stamp is received) from the GPS module, then the time stamp is processed and displayed on the TM1637 display, with blinking colon. You may also observe that, an LED on the GPS module is also blinking at 1Hz rate, called PPS (Pulse Per Second) LED. ​ By connecting Jumper J1, the displays shows UTC time, which is matching to time stamp or GMT (Greenwich Mean Time). By disconnecting Jumper J1, the display shows Local time, which is calculated by using the following variables used in the sketch. The values are dependent on the country's time settings as per GMT . Here, +5 hour 30 minutes are used for India. ​ int ADJ_HH = 5; // change the HOURS value as per your country's time w.r.t. GMT int ADJ_MM = 30; // change the MINUTES value as per your country's time w.r.t. GMT Incase, both the Jumpers J1 & J2 are dis-connected, then, the display shows Local time in 12 hour format along with AM / PM indication on any on of the LEDs. Similarly, if the Jumper J1 is disconnected and J2 is connected, then the display shows Local time in 24 hour format. Both the LEDs are OFF in this mode. ​ The serial data output at pin TX of Arduino Uno is suppressed by marking as comment / remark in the sketch. If you want to debug the code, on serial monitor , then remove the double slash before all Serial.print commands, using find and replace option, as shown below. ​ existing in sketch (find word) ---> // Serial.print . . . . . to be modified in sketch (replace with) ---> Serial.print . . . . . ​ Complete Satellite Clock project assembly, using external DC power supply (instead of USB), is shown below: For source code (arduino sketch), (SatClock.ino) , please send message through contact form . The full source code will be sent to your e-mail. If you are not willing to learn, no one can help you. If you are determined to learn, no one can stop you.

bottom of page