From design to manufacturing, we support every stage, including software development, hardware, and CAD design. Our expertise spans scalable IoT solutions, embedded software & microcontroller programming, networks & servers, smart device integration, production automation, hardware-software integration, mobile app development and web services. Whether you need custom IoT systems, connected devices, or specialized development services, we bring your ideas to life!
Leobot Electronics South Africa - Electronic Component Supplier & Development Service Provider
Leobot Electronics Online Shop
These tutorials & guides are intended to help beginners in the field of electronics get started or provide some insight into a specific component.
The information in these guides will be updated as often as possible!
Introducing you to the awesome Arduino!
This is a short introduction to the wonderful world of Arduinos!
Here we will be writing a few lines of simple code to show the basic functionality of an Arduino.
The official homepage for Arduino is https://www.arduino.cc/ and a wealth of information can be found at the official homepage of Arduino. The information in this article will be a short overview of what the use is of an Arduino and how to get started.
The official answer to "What is an Arduino?" is "Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects."
Arduinos are indeed suitable for a wide range of applications ranging from entry-level to extremely complex systems. The main objective of an Arduino is to simplify the process and to make the process of designing a new device as quick and low-cost as possible. Many times Arduinos are used to create prototype devices to showcase possible commercially viable devices, which would have cost a lot of money to design and develop were it not for the Arduino.
The Arduino is a great entry-point to get started with electronics itself. Much of the complex electronics have been hidden away for you not to worry about at all. You can simply use the Arduino to provide power to a simple circuit that you built using electronic components. The Arduino in this way provides you with much control over how much voltage provided instead of using a battery of fixed capacity. The Arduino will also easily generate waveforms for you to test AC circuitry.
The Arduino is great for programmers who have no knowledge in electronics but know how to write code. The Arduino allows you to write normal C/C++ to accomplish complex electronic functionality.
The Arduino is great for electronic engineers to help speed up the process of designing a new system. The Arduino can simulate specific functionality to allow you to build complex electronic systems based on the simulated output of the Arduino. Alternatively, the Arduino can be used as control system with much greater ease than traditional Digital circuitry would allow.
The Arduino is great for the inventor who wants to design their own devices without extremely deep knowledge in all the various aspects of electronics. The are many modules available such as sensors, controllers, motors etc. that will allow you to bring your inventions to reality.
The Arduino is great for the researcher & amateur physicist who wants to enquire into the world we live in in and find answers to the deepest questions of the Universe.
First you need to have a power supply of some sort. The Arduino is flexible enough to accept a range of different power supply setups.
1) You can power your Arduino directly from your laptop or PC's USB outlet. You can not run powerful motors will the little bit of power the a USB-port provides but it is enough to power a wide range of circuits that do not require a lot of power such as those using motors.
2) You can either provide a 9V battery to run your Arduino off, providing mobility to your device. 9V batteries are relatively ineffecient but are a good starting point.
3) You can power your Arduino directly from a wall-plug by using an AC-DC adaptor such as those used by a laptop. In fact, you can use your laptop's power cable (if it fits) to power your Arduino.
There are many code examples available on the net, including tutorials to get you started programming your Arduino. The key concept to remember is that you are simply providing instructions for what the Arduino must do and when. Coding itself involves a few 'building blocks' that you can use to accomplish any logical set of operations that you can think of. It may seem hard at first but once you realise that it is in fact extremely logical, then it will become simple to write new code. You simply need to think of the logical steps involved in the process. You do not need to know much mathematics, but you need to be able to reason logically, then simply remember (or google for help) the code instructions that you need to accomplish each task, one by one.
The programming language that Arduino use is very similar to C and C++. The more you learn on how to write C code or C++ code the better Arduino code you will be able to write. Most all programming languages are simply ways to tell the processor (such as an Arduino, PC or Laptop) to do a basic mathematical operation, such as adding two numbers, the store the result. As programmer you will then decide which next operation the processor must do on this result to obtain another new result and so on until you have accomplished your goal. The PC, Laptop, or Arduino then simply follows these instructions but at a great speed ( the CPU rate). The Arduino is capable of running 16 000 0000 instructions per second.
The first thing you need to get started is to install the Arduino IDE software. "IDE" stands for Integrated Development Environment and is simply a fancy word for software that you use to code in.
All Arduino code contains at least two functions
1) Setup() - This is used to configure pins and do initial first-run configurations so that you do not have to add extra code to detect whether it is the first time the device is being run after a shutdown.
2) Loop() - This function is the main piece of code that will execute over and over until the device is switched off.
Once you have written the code for your Arduino you need to upload the code to the Arduino. This is usually done via a USB cable and simply requires a click of a button to do.
Only once you start developing medium sized projects do you need to start taking into consideration the memory size of the Arduino. For large projects an Arduino Mega is recommended, for all other projects an Arduino Uno will be sufficient. Ensure that your Arduino is connected to your computer and in the IDE software simply click on "Upload" to load the code onto the device. The Arduino will immediately start doing the new instructions provided to it.
Sometimes you may find that you are having trouble Uploading new code to an Arduino; usually simply plugging the Arduino in & out will solve the problem. The only two other issues that will stop you from Uploading code to an Arduino is if there is a compiler error (meaning your code is not correct) or if the size of your code (the number of lines of code) is too large to upload to the Arduino. The size issue is only a problem when dealing with medium-to-large sized projects.
There are many code examples included in the Arduino IDE software. The most basic piece of code to show you how Arduino code looks is below. This code sets the "Built In LED" as an output pin during its Setup() phase and then simply turns this buil-in LED on and off a a specific interval.
// the setup function runs once when you press reset or power the boardvoid setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT);}
// the loop function runs over and over again forevervoid loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second}
The Arduino is a great controller of logic but by itself is not much more than a calculator with no input buttons or output screen. To make a device such as a fingerprint time-attendance device, or robot, you need to add extra modules to your Arduino. For example, for a robot car you may want to add 4 motors for wheels, but to control these motors, you may need an extra middle-man component that can communicate with the motor and, the Arduino communicate with the middleman device, which in this case would be a Motor Driver. You may want to add sensor modules to your robot to detect the distance to obstacles ahead of it, for which you would want to ad either a Supersonic-Sound Transducer or an Infrared Light Emitter & Detector to your Arduino. You would now write the code needed for the Arduino to read the output provided by the sensors, make some smart logical decisions, and control the motors to turn the robot in a different direction. Maybe you want your robot to have a large battery capacity and therefor decide to instead of using a 9V battery to use a lithium battery instead but you want this to be recharchable, then you would add a Lithium Battery Recharger Arduino module. You can then add a solar panel module to the robot to charge the lithium battery using sunlight. You can continue to build bigger and better projects by simply adding modules or even making different Arduinos communicate with each other to create a much larger system.
Here is an example of a complex protoype that I have designed in the past that detects a worker's alcohol level in their breath, uses a fingerprint device to auhenticate a user and keep track of their clock-in and clock-out times. All using one Arduino and a few simple modules.
18650 Lithium Battery Charging Module (5V Micro USB 1A)
R25.80
2-Chanel Logic Level Converter (LLC/IIC I2C) Bi-Directional Module 5V to 3.3V (DIY Soldering Needed)
4 Channel LLC I2C/IIC Logic Level Converter Bi-Directional Module 5V to 3.3V (DIY Soldering Needed)
R15.48
4 Channel Remote (315Mhz) + Receiver Module (315Mhz)
R58.05
4.0 Bluetooth Module (CC2540/CC2541 HM-10)
R189.00
5A Single-Phase Micro Current Transformer Module (AC Active Output, ZMCT103C)
R86.00
5mm RGB LED Module (KY-016 FZ0455)
R23.01
5V 1A Ultra-small Li-ion Lithium Battery Charger Module (DD08CRMB)
R90.72
Capacitive Touch Switch Button Self-Lock Module (11.5mm x 8mm)
R22.14
CH340G USB to Serial module (5V, 3.3V)
R51.60
DC 400W 15A Constant Current Power Supply & Step-Up Boost Converter (8.5V-50V to 10V-60V range)
R264.60
DC-DC 3.5V-30V To 4V-40V Step Up Power Supply Module LM2587 (80W Adjustable 5A Boost Converter Voltage Regulator)
R151.20
DS1302 RTC Real Time Clock Module
R34.40
DS1307 RTC Real Time Clock Module
DS3231 AT24C32 Precision Real Time Clock (RTC) Module
ESP01 Serial WiFi Power Regulator Adapter (ESP8266 compatible)
HC-SR04 Ultrasonic Distance Measuring Sensor Module
High Precision Laser Distance Range Finder Module (3.3V-5V, TTL)
R1769.04
IR Infrared Receiver Module
R43.00
LilyPad 328 Main Board (ATmega328P 16M)
R353.43
LM7805 5V Voltage Regulator Module
MAX3232 Mini RS232 to TTL Converter (3-5V)
R39.20
MICRO USB-B POWER SWITCH MODULE
R24.45
MOSFET Relay Module (0-24V Mosfet IRF520)
NE555 Adjustable Pulse Frequency Generator Module
Passive Buzzer Module
RFID Proximity Card Kit (RFID Reader/Writer Module + RFID Keyring Tag + RFID Card)
RS232 Serial Port Module (MAX3232CSE)
R89.00
Serial Micro-SD Card Module
R50.96
Serial SD Card Module
Serial Wifi Transceiver Module (Arduino)
Single Row 40 Pin Male 2.54 Breakable Pin Header Connector Strip
R4.06
SX1308 DC-DC Adjustable Step Up Power Booster Module (2-24V to 2-28V 1.2MHz 2A)
TCS3200 Color Recognition/Detector Module
R340.20
TLP281 4-Channel Opto-isolator
R68.80
Transparent Arduino Uno Enclosure Box
TTL to RS485 Converter Module (Arduino)
R29.80
TTP223 Capacitive Touch Sensor Module
R29.89
Universal LiPo Charger (4.2V/7.4V 2A)
USB - TTL SERIAL USART MODULE (PL2303/YP-01)