<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vikash DevZ on Medium]]></title>
        <description><![CDATA[Stories by Vikash DevZ on Medium]]></description>
        <link>https://medium.com/@VikashDevZ?source=rss-2de9aa68e3ef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*P7yJB3x7IgAzlI7y</url>
            <title>Stories by Vikash DevZ on Medium</title>
            <link>https://medium.com/@VikashDevZ?source=rss-2de9aa68e3ef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:57:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@VikashDevZ/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Automated Plant Watering System: Building JohnnyFive — Part 6]]></title>
            <link>https://medium.com/@VikashDevZ/automated-plant-watering-system-building-johnnyfive-part-6-f06c3b1f7809?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/f06c3b1f7809</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Tue, 25 Jul 2023 05:49:01 GMT</pubDate>
            <atom:updated>2023-07-25T05:49:01.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automated Plant Watering System: Building JohnnyFive — Part 6</h3><p>Welcome back to the sixth installment of the JohnnyFive series! In this blog, we will delve into the hardware requirements and the process of connecting them to create an Automated Plant Watering System using Johnny-Five. Let’s get our green thumbs ready and dive into the exciting world of automating plant care!</p><h3>Hardware Requirements</h3><p>To build our Automated Plant Watering System, we’ll need the following components:</p><ol><li>Arduino Board: We’ll use an Arduino board (e.g., Arduino Uno) as the micro-controller to interface with sensors and actuators.</li><li>Soil Moisture Sensor: This sensor will help us determine the moisture level of the soil and decide when to water the plants.</li><li>Water Pump: The water pump will be used to deliver water to the plants when needed.</li><li>Relay Module: We’ll use a relay module to control the water pump’s high current using the Arduino’s low current GPIO pins.</li><li>Transistor (NPN): The NPN transistor will help us drive the relay module properly.</li><li>Diode (1N4007): To protect the circuit from voltage spikes generated by the water pump when it turns off.</li><li>Power Supply: We need a suitable power supply to power the water pump and the relay module separately from the Arduino. Choose an appropriate power supply based on your water pump’s specifications.</li><li>Jumper Wires: To connect all the components together.</li><li>Water Container: You’ll need a water container that can hold an adequate amount of water to supply the plants.</li><li>Plastic Tubes: To create a watering system that can deliver water to the plants efficiently.</li><li>Breadboard and Prototyping Board: We’ll use these to create a neat and reliable circuit.</li></ol><h3>Connecting the Components</h3><p>Now that we have all the required hardware, let’s start connecting the components to the Arduino:</p><ol><li>Soil Moisture Sensor: Connect the sensor’s VCC and GND pins to the 5V and GND pins on the Arduino, respectively. Connect the sensor’s analog output to any of the analog input pins (e.g., A0).</li><li>Water Pump: Connect one terminal of the water pump to the common (COM) pin of the relay module and the other terminal to the normally open (NO) pin of the relay module.</li><li>Relay Module: Connect the relay module’s VCC and GND pins to the 5V and GND pins on the Arduino, respectively. Connect the IN1 pin of the relay module to a digital output pin (e.g., D2) on the Arduino.</li><li>Transistor (NPN): Connect the transistor’s collector pin to the relay module’s IN1 pin. Connect the transistor’s base pin to a digital output pin (e.g., D3) on the Arduino through a 1kΩ resistor. Connect the emitter pin of the transistor to the GND pin on the Arduino.</li><li>Diode (1N4007): Connect the diode’s cathode (marked with a stripe) to the relay module’s VCC pin and the anode to the relay module’s GND pin.</li><li>Water Container: Place the water container above the plants and connect one end of the plastic tube to the water pump’s outlet. Position the other end of the tube so that it delivers water directly to the plants’ roots.</li><li>Power Supply: Connect the power supply’s positive terminal to the VCC and the negative terminal to the GND on the relay module. Connect the water pump to the power supply.</li></ol><h3>Code</h3><p>Below is the complete code for the Automated Plant Watering System using JohnnyFive:</p><pre>// Require the Johnny-Five library<br>const five = require(&quot;johnny-five&quot;);<br><br>// Initialize the Arduino board<br>const board = new five.Board();<br>board.on(&quot;ready&quot;, function () {<br>  // Create a new Soil Moisture Sensor instance<br>  const moistureSensor = new five.Sensor(&quot;A0&quot;);<br>  // Create a new Relay instance for the water pump control<br>  const pumpRelay = new five.Relay(2);<br>  // Set the threshold for moisture level when the pump should turn on<br>  const moistureThreshold = 500;<br>  // Function to water the plants<br>  function waterPlants() {<br>    pumpRelay.on();<br>    setTimeout(() =&gt; {<br>      pumpRelay.off();<br>    }, 5000); // Run the pump for 5 seconds<br>  }<br>  // Function to check moisture level and water if needed<br>  function checkMoistureLevel() {<br>    const moistureLevel = moistureSensor.value;<br>    if (moistureLevel &gt; moistureThreshold) {<br>      console.log(&quot;Soil is dry. Watering plants...&quot;);<br>      waterPlants();<br>    } else {<br>      console.log(&quot;Soil moisture level is okay. No need to water.&quot;);<br>    }<br>  }<br>  // Set the interval to check moisture level every 1 hour (adjust as needed)<br>  setInterval(checkMoistureLevel, 3600000);<br>});</pre><p>In the above code, we use JohnnyFive to interact with the Arduino and control the water pump based on the soil moisture level. The moistureSensor reads the analog value from the soil moisture sensor, and the pumpRelay controls the water pump using the relay module.</p><p>The checkMoistureLevel function reads the moisture level and calls the waterPlants function if the soil moisture level is below the threshold. The waterPlants function turns on the water pump for a fixed duration (5 seconds in this case) to water the plants.</p><h3>Conclusion</h3><p>Congratulations on completing Part 6 of the JohnnyFive series, where we built an Automated Plant Watering System! By integrating the hardware components and JohnnyFive, we’ve created a smart watering system that ensures our plants get the right amount of water. This project can be further enhanced by adding features like automated scheduling, water level monitoring, and even remote control capabilities. So, let your creativity blossom, and happy gardening with your newly automated plant watering system! Stay tuned for more exciting projects in the JohnnyFive series!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f06c3b1f7809" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Johnny-Five Part 5: Arduino-Based Thermal Sensor Detects Living Beings Behind Walls]]></title>
            <link>https://medium.com/@VikashDevZ/johnny-five-part-5-arduino-based-thermal-sensor-detects-living-beings-behind-walls-be17f56165ea?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/be17f56165ea</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[johnny-five]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Thu, 20 Jul 2023 06:05:25 GMT</pubDate>
            <atom:updated>2023-07-20T06:05:25.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HY0dyZdTkryuRgkCiJjxQ.jpeg" /></figure><p>Welcome back to the fifth part of our Johnny-Five series! In this blog, we will embark on an exciting project that utilises Arduino and the Johnny-Five JavaScript robotics framework to detect living beings, such as animals, even if they are behind walls. This cutting-edge application incorporates thermal sensors, which can detect the heat emitted by living organisms and convert it into actionable data. Join us on this exploration of a project that opens up numerous possibilities, including wildlife monitoring, security applications, and beyond.</p><p><strong>Required Components</strong>:</p><p>Before we dive into the project, let’s gather all the necessary components:</p><ol><li>Arduino board (e.g., Arduino UNO)</li><li>AMG8833 Grid-EYE Thermal Camera sensor</li><li>Jumper wires</li><li>Breadboard</li><li>USB cable or battery pack (for power supply)</li></ol><p><strong>Arduino Setup</strong>:</p><p>Step 1: Connect the AMG8833 Thermal Sensor</p><p>To begin, let’s connect the AMG8833 thermal sensor to the Arduino board:</p><ul><li>Connect VCC to 5V on the Arduino board.</li><li>Connect GND to GND on the Arduino board.</li><li>Connect SDA to the A4 pin on the Arduino board.</li><li>Connect SCL to the A5 pin on the Arduino board.</li></ul><p><strong>Coding the Arduino with Johnny-Five:</strong></p><p>Step 1: Install Johnny-Five Package</p><p>Before we proceed with coding, ensure you have Node.js and npm (Node Package Manager) installed on your system. Create a new folder for the project and run the following command:</p><pre>npm init<br>npm install johnny-five</pre><p>Step 2: Write the Johnny-Five Code</p><p>Create a new JavaScript file (e.g., app.js) and write the Johnny-Five code:</p><pre>const { Board, Led } = require(&#39;johnny-five&#39;);<br><br>// Replace &#39;COM3&#39; with your Arduino port<br>const board = new Board({ port: &#39;COM3&#39; });<br>board.on(&#39;ready&#39;, () =&gt; {<br>  console.log(&#39;Arduino is ready&#39;);<br>  // Initialize the AMG8833 thermal sensor<br>  const thermalSensor = new Led({<br>    controller: &#39;AMG8833&#39;<br>  });<br>  // Event listener to detect presence of living beings<br>  thermalSensor.on(&#39;motionstart&#39;, () =&gt; {<br>    console.log(&#39;Living being detected!&#39;);<br>    // You can add any additional actions here,<br>    // such as sending a notification or triggering an alarm.<br>  });<br>  // Event listener to detect when no living beings are detected<br>  thermalSensor.on(&#39;motionend&#39;, () =&gt; {<br>    console.log(&#39;No living being detected.&#39;);<br>  });<br>});</pre><p>Ensure to replace &#39;COM3&#39; with the appropriate serial port to which your Arduino is connected.</p><p>Step 3: Save and Run the Johnny-Five Code</p><p>Save the app.js file and run it using Node.js in terminal:</p><pre>node app.js</pre><p><strong>Conclusion:</strong></p><p>Congratulations! You’ve successfully created an Arduino-based thermal sensor that can detect living beings, including animals, even if they are behind walls. This cutting-edge application showcases the potential of Johnny-Five and the AMG8833 thermal sensor, opening up a world of possibilities in wildlife monitoring, security, and more. By harnessing the power of thermal technology, you can now detect living beings with ease, even in challenging scenarios. The versatility of Johnny-Five enables you to explore and build upon this project further, incorporating additional features to suit your needs. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be17f56165ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Fully Functional Robot Car with Johnny Five: Controlling Motors and Performing Complex…]]></title>
            <link>https://medium.com/@VikashDevZ/building-a-fully-functional-robot-car-with-johnny-five-controlling-motors-and-performing-complex-f2cded2b4c17?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2cded2b4c17</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[johnny-five]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[robotics]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Thu, 13 Jul 2023 06:00:32 GMT</pubDate>
            <atom:updated>2023-07-13T06:02:09.777Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Fully Functional Robot Car with Johnny Five: Controlling Motors and Performing Complex Motions Part 4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HY0dyZdTkryuRgkCiJjxQ.jpeg" /></figure><p>In this blog post, we will explore how to build a fully functional robot car using the Johnny Five JavaScript robotics framework. We’ll focus on connecting four motors (not servos) and controlling each motor individually to enable movement in multiple directions. Additionally, we will delve into programming the robot car to perform various motions, including moving in a square, a circle, and even dancing. By the end of this guide, you’ll have a working robot car capable of executing these complex motions.</p><p><strong>Required Components</strong>: To get started, let’s gather the components required for our project:</p><ol><li>Arduino board (e.g., Arduino Uno)</li><li>Motor driver module (e.g., L293D or similar)</li><li>Four DC motors (ensure they match the motor driver specifications)</li><li>Jumper wires for connections</li><li>Power supply for the motors (battery pack or external power source)</li><li>Chassis for the robot car</li><li>Wheels and castor wheel for mobility</li><li>Breadboard (optional, for prototyping and connections)</li><li>Laptop or computer for programming and control</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ENgglhwXKbceHpnXc4zC1w.jpeg" /><figcaption>L298N Motor driver</figcaption></figure><p><strong>Connecting the Components</strong>: Now that we have the necessary components, let’s proceed with connecting them to build our robot car:</p><ol><li>Connect the Arduino board to your computer using a USB cable.</li><li>Attach the motor driver module to the Arduino board, ensuring the correct pin connections.</li><li>Connect the four DC motors to the motor driver module outputs, following the wiring instructions specific to your chosen motor driver.</li><li>Establish a separate power supply for the motors, connecting it to the motor driver module and ensuring proper voltage and current ratings.</li><li>Assemble the chassis, attach the wheels, and mount the motors in their designated positions.</li><li>Use jumper wires to establish the necessary connections between the Arduino board and the motor driver module, ensuring correct pin assignments.</li><li>Double-check all connections to ensure they are secure and properly wired.</li></ol><p><strong>Controlling the Motors with Johnny Five</strong>: To control the motors of our robot car, we will leverage the Johnny Five JavaScript robotics framework. Johnny Five allows us to interact with hardware devices, such as Arduino boards, using familiar JavaScript syntax. Let’s dive into the code:</p><p>Install the required dependencies: Begin by setting up a Node.js project and installing the Johnny Five library using npm.</p><pre>npm install johnny-five</pre><p>Set up the initial code structure: Create a new JavaScript file (e.g., robot-car.js) and import the Johnny Five library. Initialize Johnny Five by connecting to the Arduino board.</p><pre>const { Board } = require(&quot;johnny-five&quot;);<br>const board = new Board();<br>board.on(&quot;ready&quot;, function() {<br>  // Your code goes here<br>});</pre><p>Define motor pins and instantiate the motors: In the board.on(&quot;ready&quot;) callback, specify the pins connected to each motor and create motor instances using Johnny Five&#39;s Motor class.</p><pre>const motor1 = new five.Motor({ pins: { pwm: 3, dir: 12 } });<br>const motor2 = new five.Motor({ pins: { pwm: 5, dir: 13 } });<br>const motor3 = new five.Motor({ pins: { pwm: 6, dir: 10 } });<br>const motor4 = new five.Motor({ pins: { pwm: 9, dir: 11 } });</pre><p>Controlling individual motors: Now, you can control each motor individually by calling methods on the motor instances. For example, to make motor 1 move forward:</p><pre>motor1.forward(speed);</pre><p>You can control the speed using values between 0 and 255, where 0 represents no movement, and 255 represents full speed.</p><p>Performing Complex Motions: To make our robot car perform complex motions like moving in a square, a circle, or dancing, we need to combine the individual motor controls in a synchronized manner. Here’s an example of programming the robot car to move in a square:</p><pre>function moveInSquare() {<br>  // Move forward for a certain duration<br>  motor1.forward(speed);<br>  motor2.forward(speed);<br>  motor3.forward(speed);<br>  motor4.forward(speed);<br>  board.wait(2000, function() {<br>    // Stop and wait for a brief moment<br>    motor1.stop();<br>    motor2.stop();<br>    motor3.stop();<br>    motor4.stop();<br>    board.wait(500, function() {<br>      // Turn right for a certain duration<br>      motor1.forward(speed);<br>      motor2.reverse(speed);<br>      motor3.forward(speed);<br>      motor4.reverse(speed);<br>      board.wait(1000, function() {<br>        // Stop and wait for a brief moment<br>        motor1.stop();<br>        motor2.stop();<br>        motor3.stop();<br>        motor4.stop();<br>        board.wait(500, function() {<br>          // Repeat the pattern for the remaining sides<br>          // You can implement the other sides of the square using similar code<br>        });<br>      });<br>    });<br>  });<br>}</pre><p>By modifying the above code, you can program the robot car to perform other motions, such as moving in a circle or dancing, by combining appropriate motor movements and timing.</p><p><strong>Conclusion</strong>: Congratulations! You have successfully built a fully functional robot car using Johnny Five, connected four motors, and learned how to control each motor individually. Additionally, you have explored programming the robot car to perform complex motions like moving in a square, a circle, and even dancing. With this knowledge, you can further expand the capabilities of your robot car and explore more exciting projects in the world of robotics.</p><p>Remember to experiment, be creative, and continue exploring the vast possibilities of robotics using Johnny Five. Happy tinkering and have fun building your own robotic creations!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2cded2b4c17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building JohnnyFive: Part 3 Attaching and Controlling Servo Motors]]></title>
            <link>https://blog.devgenius.io/building-johnnyfive-part-3-attaching-and-controlling-servo-motors-6f3b078363dc?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f3b078363dc</guid>
            <category><![CDATA[johnny-five]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Wed, 21 Jun 2023 11:41:01 GMT</pubDate>
            <atom:updated>2023-06-30T11:03:55.650Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HY0dyZdTkryuRgkCiJjxQ.jpeg" /></figure><p><strong>Introduction</strong>: Welcome back to the ongoing series on building JohnnyFive, the interactive robot companion. In the previous articles, we covered the basics of setting up JohnnyFive’s hardware components and understanding its architecture. In this third installment, we’ll explore the process of attaching servo motors to JohnnyFive and learn how to move them according to specific commands. We will dive into the code required for controlling the servos and discuss the appropriate ports for connecting them. So let’s get started!</p><p><strong>Understanding Servo Motors</strong>: Servo motors are widely used in robotics projects due to their precise control over angular motion. These motors are commonly used to move robot arms, open and close grippers, or rotate sensors. Servos consist of a motor, gears, and a control circuit. The control circuit allows you to set the desired angle of rotation, typically ranging from 0 to 180 degrees.</p><p><strong>Choosing the Right Servo Motor</strong>: Before attaching the servo motor to JohnnyFive, it is essential to select the appropriate servo for your specific project requirements. Servos come in various sizes, torque ratings, and speed capabilities. Consider factors such as weight capacity, power requirements, and response time to ensure compatibility with JohnnyFive’s design. Additionally, check the servo’s datasheet for voltage specifications and control signal compatibility.</p><p><strong>Attaching Servo Motors to JohnnyFive</strong>: To attach the servo motors to JohnnyFive, you’ll need the following materials:</p><ol><li>JohnnyFive robot chassis or base</li><li>Servo motors (quantity as per your project needs)</li><li>Jumper wires</li><li>Breadboard (optional, for ease of connections)</li><li>Power supply (based on the voltage requirements of your servos)</li></ol><p><strong>Procedure:</strong></p><ol><li>Identify the appropriate ports on JohnnyFive’s microcontroller to connect the servos. For demonstration purposes, we’ll assume that you are using an Arduino Uno, which has multiple PWM (Pulse Width Modulation) pins suitable for servo control.</li><li>Connect the power and ground wires of each servo to the power supply. Ensure that the power supply voltage matches the servo’s specifications.</li><li>Connect the control wires of each servo to the PWM pins on the microcontroller. Typically, the control wire is colored white or yellow and connects to a digital pin capable of generating PWM signals.</li><li>If you are using a breadboard, connect the power and ground wires of the servos to the appropriate rails on the breadboard.</li><li>Make sure to secure the servos properly to JohnnyFive’s chassis, ensuring that they are stable and won’t interfere with other components’ movement.</li><li>Apologies for the oversight. Let’s provide you with the details on how to connect the pins and power for the servo motors in JohnnyFive.</li></ol><p><strong>Connecting Servo Motors to JohnnyFive:</strong></p><ol><li>Power Connection:</li></ol><ul><li>Connect the positive (+) terminal of the power supply to the servo’s Vcc (power) pin.</li><li>Connect the negative (-) terminal of the power supply to the servo’s GND (ground) pin.</li><li>Ensure that the power supply voltage matches the servo’s specifications. Common voltages for servos are 5V or 6V, but check the datasheet or product documentation for your specific servo model.</li></ul><ol><li>Signal Connection:</li></ol><ul><li>Connect the signal (control) wire of each servo to the appropriate digital pin on the microcontroller. The control wire is typically colored white or yellow.</li><li>Since we assumed the use of an Arduino Uno for this demonstration, the Uno has several PWM (Pulse Width Modulation) pins suitable for servo control.</li><li>Determine the digital pin number you want to use for each servo and connect the control wire to the corresponding pin on the Arduino Uno.</li></ul><ol><li>Multiple Servos:</li></ol><ul><li>If you are using multiple servos, repeat the power and signal connections for each servo.</li><li>Ensure that each servo is connected to a different digital pin on the microcontroller for independent control.</li></ul><blockquote>Note: It’s important to avoid overloading the microcontroller’s power capabilities. If you’re using multiple servos or high-torque servos, consider using an external power supply specifically designed for servo motors. Connect the external power supply’s negative terminal to the microcontroller’s GND pin to establish a common ground.</blockquote><p><strong>Example Pin and Power Connections:</strong></p><p>Let’s assume you are connecting a single servo motor to an Arduino Uno. Here’s an example of how you can make the connections:</p><ul><li>Connect the servo’s Vcc (power) pin to the 5V pin on the Arduino Uno.</li><li>Connect the servo’s GND (ground) pin to any GND pin on the Arduino Uno.</li><li>Connect the servo’s signal (control) wire to a digital pin on the Arduino Uno, such as pin 9.</li></ul><blockquote><strong>Note</strong>: It’s always a good practice to consult the datasheet or product documentation of your specific servo motor to verify the correct voltage and wiring connections for your particular model.</blockquote><p>Controlling Servo Motors: Now that we have the servos connected to JohnnyFive, let’s dive into the code required to control them. In this example, we’ll use JavaScript and the Johnny-Five robotics framework to program the microcontroller.</p><p><strong>Prerequisites:</strong></p><ol><li>Install Node.js on your computer.</li><li>Set up the Johnny-Five library by following the installation instructions in the official documentation or <a href="https://medium.com/@pvickey663/getting-started-with-johnny-five-an-introduction-to-robotics-and-iot-programming-27e8d3ea7238">Getting Started with Johnny-Five: An Introduction to Robotics and IoT Programming</a>.</li></ol><p>Here’s an example code snippet to control a single servo using Johnny-Five:</p><pre>const { Board, Servo } = require(&quot;johnny-five&quot;);<br><br>// Define the board<br>const board = new Board();<br>// Function to initialize the board and servos<br>board.on(&quot;ready&quot;, () =&gt; {<br>  // Create a servo instance<br>  const servo = new Servo({<br>    pin: 9, // Specify the pin connected to the servo<br>    range: [0, 180], // Set the range of motion for the servo<br>  });<br>  // Move the servo to a specific angle<br>  servo.to(90); // Move to the 90-degree position<br>  // Rotate the servo continuously<br>  servo.sweep({<br>    range: [0, 180], // Set the sweeping range<br>    interval: 500, // Set the interval between steps (in milliseconds)<br>  });<br>});</pre><p>Explanation:</p><ol><li>The code imports the necessary modules from the Johnny-Five library and creates a new board instance.</li><li>Inside the board’s “ready” event handler, we create a new Servo object, specifying the pin to which the servo is connected and the range of motion.</li><li>Using the servo.to(angle) method, we can move the servo to a specific angle.</li><li>The servo.sweep(options) method allows the servo to continuously rotate within the specified range and interval.</li></ol><p>Remember to adapt the pin number in the code according to the actual pin you used to connect the servo on JohnnyFive.</p><p><strong>Conclusion</strong>: In this article, we explored the process of attaching and controlling servo motors in JohnnyFive. We discussed the significance of selecting the right servo for your project, the steps for physically attaching the servos to JohnnyFive, and the code required to control them using the Johnny-Five framework. By following these guidelines, you can integrate servo motors into your robotics projects and unleash the full potential of JohnnyFive’s mechanical capabilities.</p><p>In the next part of this series, we will dive deeper into JohnnyFive’s programming aspects and learn how to interact with much more component for capturing environmental data. Stay tuned for more exciting developments in building your own robot companion!</p><p><strong>Disclaimer</strong>: The information provided in this article is for educational purposes only. Always exercise caution when working with electrical components, and refer to the manufacturer’s documentation for specific instructions related to your servo motors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f3b078363dc" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/building-johnnyfive-part-3-attaching-and-controlling-servo-motors-6f3b078363dc">Building JohnnyFive: Part 3 Attaching and Controlling Servo Motors</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing the Power of Johnny-Five: Fire Detection with Sensors]]></title>
            <link>https://medium.com/@VikashDevZ/unleashing-the-power-of-johnny-five-fire-detection-with-sensors-1dd1ca30dfea?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/1dd1ca30dfea</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[johnny-five]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 12:29:59 GMT</pubDate>
            <atom:updated>2023-06-15T12:29:59.139Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HY0dyZdTkryuRgkCiJjxQ.jpeg" /></figure><p>Introduction: Welcome back, fellow tech enthusiasts! Today, we’re diving into the captivating world of Johnny-Five, an incredible JavaScript robotics framework that allows us to interact with hardware devices effortlessly. In this blog post, we’ll explore how to harness the potential of Johnny-Five to detect fire using sensors. So, let’s set the spark and get started!</p><blockquote>Remember, fire safety is of paramount importance. Always ensure that you follow the necessary safety protocols and regulations when working with fire detection systems or any other fire-related projects.</blockquote><p>Understanding Johnny-Five: Johnny-Five is a versatile framework that enables developers to control and communicate with a wide range of hardware components using JavaScript. It provides an abstraction layer that simplifies the interaction with devices, making it accessible even to beginners. With Johnny-Five, we can unleash the true potential of our hardware and build exciting projects.</p><p>Fire Detection with Johnny-Five and Sensors: One of the critical applications of Johnny-Five is fire detection. By utilizing various sensors, we can create a system that alerts us to the presence of fire, allowing us to take prompt action and ensure safety. Let’s take a closer look at how we can achieve this using Johnny-Five and a few commonly used sensors.</p><ol><li>Flame Sensor: The flame sensor is an essential component for fire detection. It can detect the infrared (IR) light emitted by flames. The sensor consists of an IR receiver that detects the presence of IR light and a comparator circuit that converts the received signal into a digital output. To connect the flame sensor to your board, follow these steps:</li></ol><ul><li>Connect the VCC pin of the flame sensor to a 5V pin on your board or to the appropriate power supply.</li><li>Connect the GND pin of the flame sensor to a GND pin on your board.</li><li>Connect the OUT pin of the flame sensor to a digital or analog pin on your board, depending on the type of output it provides.</li></ul><ol><li>Temperature Sensor: Another crucial sensor for fire detection is the temperature sensor. It measures the ambient temperature and helps identify any abnormal rise that may indicate the presence of a fire. Popular temperature sensors like the LM35 or the DS18B20 can be easily integrated into our Johnny-Five project. To connect a temperature sensor to your board, follow these steps:</li></ol><ul><li>Connect the VCC pin of the temperature sensor to a 5V pin on your board or to the appropriate power supply.</li><li>Connect the GND pin of the temperature sensor to a GND pin on your board.</li><li>Connect the OUT pin of the temperature sensor to a digital or analog pin on your board, depending on the type of output it provides.</li></ul><ol><li>Smoke Sensor: Smoke sensors are widely used in fire alarm systems. They detect the presence of smoke particles in the air, which could indicate the start of a fire. Smoke sensors employ various technologies such as optical, ionization, or photoelectric methods to sense the presence of smoke. To connect a smoke sensor to your board, follow these steps:</li></ol><ul><li>Connect the VCC pin of the smoke sensor to a 5V pin on your board or to the appropriate power supply.</li><li>Connect the GND pin of the smoke sensor to a GND pin on your board.</li><li>Connect the output pin of the smoke sensor to a digital or analog pin on your board, depending on the type of output it provides.</li></ul><p>Building the Fire Detection System: To build our fire detection system, we need to connect the sensors to our microcontroller or development board, such as an Arduino, Raspberry Pi, or any compatible platform. Johnny-Five offers excellent support for these platforms, allowing us to write JavaScript code to interact with the connected sensors easily.</p><p>Once the sensors are properly connected, we can use Johnny-Five’s API to read data from the sensors. For example, with a flame sensor, we can continuously check its digital output state. If a flame is detected, we can trigger an action like activating an alarm, sending notifications, or initiating an automated fire suppression system.</p><p>Code Implementation: Here’s a basic example of how you can use Johnny-Five with a flame sensor to detect fire:</p><pre>const five = require(&#39;johnny-five&#39;);<br><br>// Initialize the board<br>const board = new five.Board();<br>// When the board is ready<br>board.on(&#39;ready&#39;, function() {<br>  // Create a new flame sensor instance<br>  const flameSensor = new five.Sensor(&#39;A0&#39;);<br>  // When the flame sensor detects a change in value<br>  flameSensor.on(&#39;change&#39;, function() {<br>    // If the flame sensor detects a flame<br>    if (this.value &gt; 500) {<br>      console.log(&#39;Fire detected!&#39;);<br>      // Perform actions like activating an alarm, sending notifications, etc.<br>      // You can also interface with other devices or systems here.<br>    }<br>  });<br>});</pre><p><strong>Conclusion</strong>: Johnny-Five opens up a world of possibilities when it comes to hardware interaction, and fire detection is just one fascinating application. By utilizing sensors like flame sensors, temperature sensors, and smoke sensors, we can build an efficient fire detection system that helps protect lives and property.</p><p>So, go ahead and let your creativity and Johnny-Five skills soar as you embark on new adventures in the realm of hardware interaction and fire detection. Stay safe, be innovative, and keep exploring the endless possibilities offered by Johnny-Five!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dd1ca30dfea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Agora into Your Node.js and React Application: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@VikashDevZ/integrating-agora-into-your-node-js-and-react-application-a-step-by-step-guide-4b0b267787ff?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b0b267787ff</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[agora]]></category>
            <category><![CDATA[livestream]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Mon, 12 Jun 2023 09:38:48 GMT</pubDate>
            <atom:updated>2023-06-12T09:38:48.388Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction: In today’s interconnected world, real-time communication plays a crucial role in many applications. Whether you’re building a video conferencing app, live streaming platform, or a collaborative workspace, incorporating robust and reliable communication features is essential. Agora.io, a leading provider of real-time engagement solutions, offers a powerful SDK that allows developers to easily integrate audio, video, and interactive broadcasting capabilities into their applications. In this blog post, we will walk you through the process of integrating Agora into your Node.js and React application, exploring its features and demonstrating how to use it for different events.</p><p>Table of Contents:</p><ol><li>What is Agora.io?</li><li>Why Agora?</li><li>Prerequisites</li><li>Setting Up the Node.js Backend</li><li>Creating a React Frontend</li><li>Implementing Agora SDK in Node.js and React 6.1. Installing the Agora SDK 6.2. Initializing Agora 6.3. Joining a Channel 6.4. Publishing and Subscribing to Streams 6.5. Handling Events and Stream Lifecycle</li><li>Testing the Application</li><li>Conclusion</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h8LIKb67YwqEf7pMDJfCXQ.jpeg" /></figure><ol><li><strong>What is Agora.io?</strong> Agora.io is a real-time engagement platform that provides a suite of APIs and SDKs to enable seamless audio, video, and interactive broadcasting capabilities in applications. It offers a wide range of features, including voice and video calls, real-time messaging, live broadcasting, and interactive streaming. Agora’s SDKs are available for various platforms and programming languages, making it highly versatile and accessible.</li><li><strong>Why Agora?</strong> Agora.io stands out for several reasons:</li></ol><ul><li>Ease of Integration: Agora provides well-documented SDKs and APIs, making it easy to integrate into your applications.</li><li>Scalability: Agora’s infrastructure is designed to handle high concurrency, ensuring smooth real-time communication even with a large number of participants.</li><li>Rich Features: Agora offers a wide range of features such as multi-channel publishing, screen sharing, interactive whiteboards, and real-time messaging, allowing you to build immersive and interactive experiences.</li><li>Cross-Platform Support: Agora SDKs are available for multiple platforms, including Node.js and React, enabling you to create cross-platform applications with ease.</li></ul><ol><li><strong>Prerequisites</strong>: Before we begin, make sure you have the following prerequisites in place:</li></ol><ul><li>Node.js installed on your machine</li><li>Basic knowledge of Node.js and React</li><li>A text editor or integrated development environment (IDE) of your choice</li></ul><ol><li><strong>Setting Up the Node.js Backend:</strong> To start, let’s set up the Node.js backend that will handle Agora-related functionality. Follow these steps: Step 1: Create a new directory for your project and navigate to it using the command line. Step 2: Initialize a new Node.js project by running the command: npm init -y. Step 3: Install the required dependencies by executing the command: npm install agora-rtc-sdk.</li><li><strong>Creating a React Frontend:</strong> Next, let’s create a React frontend that will interact with the Node.js backend and provide a user interface for your Agora-powered application. Perform the following steps: Step 1: Create a new React project by running the command: npx create-react-app agora-app. Step 2: Navigate to the project directory using the command: cd agora-app. Step 3: Open the project in your preferred text editor or IDE.</li><li><strong>Implementing Agora SDK in Node.js and React:</strong> Now that we have the backend and frontend set up, let’s integrate Agora into our application.</li></ol><p>6.1. <strong>Installing the Agora SDK:</strong> In your Node.js project, import the Agora SDK by adding the following line at the top of your main server file (e.g., app.js):</p><pre>const AgoraRTC = require(&quot;agora-rtc-sdk&quot;);</pre><p>6.2. <strong>Initializing Agora:</strong> Initialize Agora by creating a new AgoraRTC client instance. Add the following code to your server file:</p><pre>const client = AgoraRTC.createClient({ mode: &quot;rtc&quot;, codec: &quot;vp8&quot; });</pre><p>6.3.<strong> Joining a Channel:</strong> To join a channel, implement the following code on the client-side (React component):</p><pre>import AgoraRTC from &quot;agora-rtc-sdk&quot;;<br><br>// Inside your React component<br>const client = AgoraRTC.createClient({ mode: &quot;rtc&quot;, codec: &quot;vp8&quot; });<br>// Join a channel<br>client.join(appId, channel, token, uid, (uid) =&gt; {<br>  // Handle successful join<br>}, (error) =&gt; {<br>  // Handle join error<br>});</pre><pre>Note: Replace appId, channel, token, and uid with appropriate values.</pre><p>6.4. Publishing and Subscribing to Streams: To publish and subscribe to streams, use the following code snippets:</p><p>Publishing a Stream:</p><pre>// Publish a stream<br>client.publish(stream, (error) =&gt; {<br>  // Handle publish error<br>});e</pre><p>Subscribing to a Stream:</p><pre>// Subscribe to a stream<br>client.subscribe(stream, (error) =&gt; {<br>  // Handle subscription error<br>});</pre><p>6.5. Handling Events and Stream Lifecycle: Agora provides various events to handle stream lifecycle and communication events. Here are a few examples:</p><ul><li>stream-added: Triggered when a new stream is added to the channel.</li><li>stream-subscribed: Triggered when a remote stream is successfully subscribed.</li><li>stream-removed: Triggered when a remote stream is removed or goes offline.</li></ul><p>Register event listeners and handle events using the following code:</p><pre>// Register event listeners<br>client.on(&quot;stream-added&quot;, (event) =&gt; {<br>  // Handle new stream added<br>});<br><br>client.on(&quot;stream-subscribed&quot;, (event) =&gt; {<br>  // Handle stream subscribed<br>});<br>client.on(&quot;stream-removed&quot;, (event) =&gt; {<br>  // Handle stream removed<br>});</pre><ol><li>Testing the Application: At this stage, you should have a functioning Agora integration in your Node.js and React application. Start your Node.js server and run the React application to test the Agora features you implemented.</li><li>Conclusion: Congratulations! You’ve successfully integrated Agora into your Node.js and React application. You explored Agora’s features, learned how to initialize Agora, join channels, publish and subscribe to streams, and handle events. With Agora, you can now build powerful real-time communication applications that deliver seamless audio, video, and interactive experiences.</li></ol><p>Remember to refer to Agora’s official documentation for detailed information on SDK features, customization options, and advanced functionalities. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b0b267787ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Nodemailer: A Comprehensive Guide for Sending Emails with Node.js]]></title>
            <link>https://medium.com/@VikashDevZ/getting-started-with-nodemailer-a-comprehensive-guide-for-sending-emails-with-node-js-4f42b91a75a?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f42b91a75a</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Wed, 07 Jun 2023 12:48:45 GMT</pubDate>
            <atom:updated>2023-06-07T12:48:45.059Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction: In today’s digital era, email remains one of the most crucial communication channels. Whether you’re building a web application, a marketing campaign, or simply automating email notifications, having a reliable and efficient way to send emails from your Node.js application is essential. Enter Nodemailer, a powerful and popular Node.js library that simplifies the process of sending emails. In this comprehensive guide, we’ll dive deep into Nodemailer and explore how you can get started with it to enhance your email-sending capabilities.</p><p>Table of Contents:</p><ol><li>What is Nodemailer?</li><li>Installation</li><li>Setting up a Basic Email</li><li>Adding Attachments</li><li>Sending HTML Emails</li><li>Using Templates</li><li>Working with SMTP Servers</li><li>Error Handling and Debugging</li><li>Security Considerations</li><li>Conclusion</li><li>What is Nodemailer? Nodemailer is a Node.js module that enables easy and flexible email sending. It provides a straightforward API for creating and sending emails with various transport methods, including SMTP, sendmail, and more. With Nodemailer, you can send plain text emails, HTML emails, attachments, and even work with templates to create personalized messages.</li><li>Installation: To get started with Nodemailer, you need to install it as a dependency in your Node.js project. Open your terminal and navigate to your project directory, then run the following command:</li></ol><pre>npm install nodemailer</pre><p>This command will download and install the latest version of Nodemailer from the npm registry.</p><p><strong>Setting up a Basic Email</strong>: Once Nodemailer is installed, you can start using it to send emails. To create a basic email, you’ll need to require the Nodemailer module and set up a transport configuration. Here’s a simple example:</p><pre>const nodemailer = require(&#39;nodemailer&#39;);<br><br>// Create a transporter object<br>const transporter = nodemailer.createTransport({<br>  service: &#39;Gmail&#39;,<br>  auth: {<br>    user: &#39;your-email@gmail.com&#39;,<br>    pass: &#39;your-password&#39;<br>  }<br>});<br>// Define the email options<br>const mailOptions = {<br>  from: &#39;your-email@gmail.com&#39;,<br>  to: &#39;recipient@example.com&#39;,<br>  subject: &#39;Hello from Nodemailer&#39;,<br>  text: &#39;This is a test email sent using Nodemailer.&#39;<br>};<br>// Send the email<br>transporter.sendMail(mailOptions, (error, info) =&gt; {<br>  if (error) {<br>    console.log(&#39;Error:&#39;, error);<br>  } else {<br>    console.log(&#39;Email sent:&#39;, info.response);<br>  }<br>});</pre><p>In this example, we create a transporter object by providing the SMTP service details (in this case, Gmail) and the authentication credentials. We then define the email options, including the sender, recipient, subject, and text content. Finally, we use the transporter to send the email and handle any errors or success responses.</p><p>Adding Attachments: Nodemailer allows you to include attachments in your emails, such as images, documents, or any other file type. You can specify attachments as an array of objects, where each object contains the file path, filename, and optional content type.</p><p>Here’s an example:</p><pre>const mailOptions = {<br>  from: &#39;your-email@gmail.com&#39;,<br>  to: &#39;recipient@example.com&#39;,<br>  subject: &#39;Email with Attachments&#39;,<br>  text: &#39;Please find attached files.&#39;,<br>  attachments: [<br>    { path: &#39;/path/to/file1.txt&#39; },<br>    { path: &#39;/path/to/file2.pdf&#39; },<br>    { path: &#39;/path/to/image.jpg&#39; }<br>  ]<br>};</pre><p>By including the attachments property in the mailOptions object, you can easily send files along with your email.</p><p><strong>Sending HTML Emails</strong>: With Nodemailer, you can send HTML emails that contain formatted content, images, links, and more. To send an HTML email, update the mailOptions object to include an HTML property, like this:</p><pre>const mailOptions = {<br>  from: &#39;your-email@gmail.com&#39;,<br>  to: &#39;recipient@example.com&#39;,<br>  subject: &#39;HTML Email&#39;,<br>  html: &#39;&lt;h1&gt;Hello from Nodemailer&lt;/h1&gt;&lt;p&gt;This is an HTML email.&lt;/p&gt;&#39;<br>};</pre><p>By providing the HTML content in the html property, Nodemailer will send the email as an HTML message.</p><p><strong>Using Templates</strong>: To create personalized emails or generate dynamic content, Nodemailer supports the use of templates. You can use templating engines like Handlebars, EJS, or Pug to generate HTML content dynamically. Here’s an example using the Handlebars templating engine:</p><pre>const handlebars = require(&#39;handlebars&#39;);<br><br>// Define the template source<br>const source = `<br>  &lt;h1&gt;Hello, {{name}}!&lt;/h1&gt;<br>  &lt;p&gt;Thanks for subscribing to our newsletter.&lt;/p&gt;<br>`;<br>// Create a template function<br>const template = handlebars.compile(source);<br>// Generate the HTML content<br>const html = template({ name: &#39;John&#39; });<br>// Update the mailOptions object<br>const mailOptions = {<br>  from: &#39;your-email@gmail.com&#39;,<br>  to: &#39;recipient@example.com&#39;,<br>  subject: &#39;Newsletter Subscription&#39;,<br>  html: html<br>};</pre><p>In this example, we use the Handlebars templating engine to create a template source with placeholders for dynamic content. We then compile the template source into a template function and generate the HTML content by passing an object with the actual data. Finally, we update the mailOptions object to include the dynamic HTML content.</p><p><strong>Working with SMTP Servers</strong>: Nodemailer supports various transport methods, but SMTP (Simple Mail Transfer Protocol) is the most commonly used one. By default, Nodemailer uses a built-in SMTP transport, but you can also configure it to use an external SMTP server. Here’s an example of using a custom SMTP server:</p><pre>const transporter = nodemailer.createTransport({<br>  host: &#39;smtp.example.com&#39;,<br>  port: 587,<br>  secure: false,<br>  auth: {<br>    user: &#39;your-email@example.com&#39;,<br>    pass: &#39;your-password&#39;<br>  }<br>});</pre><p>In this example, we specify the host and port of the SMTP server and provide the authentication credentials. The secure option indicates whether the connection should use SSL/TLS encryption.</p><ol><li>Error Handling and Debugging: When working with Nodemailer, it’s crucial to handle errors properly and debug any issues that may arise. Nodemailer provides a callback function that returns an error object if an error occurs during the email sending process. You can use this information to log the error or perform appropriate error handling. Additionally, Nodemailer offers built-in debugging capabilities, allowing you to enable verbose logging for troubleshooting purposes.</li><li>Security Considerations: When working with Nodemailer, it’s important to ensure the security of your email communications. Always use secure connections (TLS/SSL) when transmitting sensitive information, such as authentication credentials. Furthermore, be mindful of potential email abuse and spam-related issues. Familiarize yourself with the best practices and guidelines provided by email service providers to maintain a good sending reputation.</li><li>Conclusion: Nodemailer is a powerful Node.js library that simplifies the process of sending emails from your applications. In this guide, we’ve covered the basics of getting started with Nodemailer, including installation, setting up basic emails, adding attachments, sending HTML emails, working with templates, configuring SMTP servers, error handling, and security considerations. By leveraging the capabilities of Nodemailer, you can enhance your application’s communication capabilities and deliver engaging email experiences to your users.</li></ol><p>Remember, this guide only scratches the surface of what Nodemailer can do. Explore the official Nodemailer documentation for more advanced features and customization options. Happy emailing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f42b91a75a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Johnny-Five: An Introduction to Robotics and IoT Programming]]></title>
            <link>https://medium.com/@VikashDevZ/getting-started-with-johnny-five-an-introduction-to-robotics-and-iot-programming-27e8d3ea7238?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/27e8d3ea7238</guid>
            <category><![CDATA[johnny-five]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Mon, 29 May 2023 09:42:48 GMT</pubDate>
            <atom:updated>2023-05-29T09:42:48.664Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HY0dyZdTkryuRgkCiJjxQ.jpeg" /></figure><p>Are you interested in exploring the world of robotics and Internet of Things (IoT) development? If so, then Johnny-Five is the perfect package to kickstart your journey! Johnny-Five is a JavaScript robotics and IoT framework that allows you to interact with a wide range of hardware components using a simple and intuitive API. In this guide, we’ll walk you through the basics of Johnny-Five, showcase its LED feature, and demonstrate how to connect new components like Bluetooth, Wi-Fi, and sensors.</p><h3>What is Johnny-Five?</h3><p>Johnny-Five is a JavaScript framework that brings the power of JavaScript to the physical world. It enables you to control and interact with various hardware components, such as sensors, actuators, and displays, using JavaScript code. Whether you’re a beginner or an experienced developer, Johnny-Five makes it easy to prototype, experiment, and build real-world projects without the need for complex low-level programming.</p><h3>Getting Started</h3><p>To get started with Johnny-Five, follow these simple steps:</p><ol><li>Install Node.js: Ensure that Node.js is installed on your system. You can download and install it from the official Node.js website (<a href="https://nodejs.org/">https://nodejs.org</a>).</li><li>Create a New Project: Open your terminal and create a new directory for your Johnny-Five project. Navigate to the project directory.</li><li>Initialize Node.js Project: Run the following command to initialize a new Node.js project and generate a package.json file.</li></ol><ul><li>npm init -y</li></ul><ol><li>Install Johnny-Five: Install the Johnny-Five package by running the following command in your project directory:</li></ol><ul><li>npm install johnny-five</li></ul><ol><li>Connect Your Hardware: Connect the hardware components you want to control or interact with, such as an Arduino board or Raspberry Pi, to your computer.</li><li>Write Your First Johnny-Five Code: Create a new JavaScript file, let’s say index.js, and start writing your Johnny-Five code.</li></ol><pre>const { Board, Led } = require(&#39;johnny-five&#39;);  <br>// Initialize Johnny-Five board <br>const board = new Board();  <br><br>// When the board is ready <br>board.on(&#39;ready&#39;, () =&gt; {<br><br>// Create an LED instance   <br>const led = new Led(13);    <br><br>// Blink the LED every 500ms   <br>led.blink(500);<br>});</pre><blockquote>Run Your Johnny-Five Code: Save the file and run your Johnny-Five code using Node.js:</blockquote><ul><li>node index.js</li></ul><p>You should see the LED connected to pin 13 on your hardware board blinking every 500 ms.</p><h3>Exploring the LED Feature</h3><p>The LED feature in Johnny-Five allows you to control LED connected to your hardware board. Let’s dive into some of the key functionalities of the LED class:</p><ul><li>Blinking: You can make an LED blink at a specified interval using the blink() method. For example, led.blink(500) will make the LED blink every 500ms.</li><li>Turning On and Off: You can manually turn the LED on and off using the on() and off() methods, respectively. For instance, led.on() will turn the LED on, and led.off() will turn it off.</li><li>Pulsing: If you want to create a pulsing effect on the LED, you can use the pulse() method. It allows you to control the brightness of the LED by specifying the fade-in and fade-out duration.</li></ul><p>These are just a few examples of what you can do with the LED feature in Johnny-Five. Feel free to explore the official Johnny-Five documentation (<a href="https://github.com/rwaldron/johnny-five">https://example.com/johnny-five-docs</a>) for more detailed information and additional functionalities.</p><h3>Connecting New Components</h3><p>Johnny-Five not only supports LED but also a wide range of other hardware components. Here’s a high-level overview of how you can connect new components:</p><ol><li>Identify the Component: Determine the type of component you want to connect, such as Bluetooth, WiFi module, sensors (temperature, motion, etc.), or actuators (servos, motors, etc.).</li><li>Find the Appropriate Class: Consult the Johnny-Five documentation to find the relevant class for your component. Each component usually has a dedicated class or set of classes to interact with it.</li><li>Import the Class: In your JavaScript file, import the required class from the Johnny-Five package.</li><li>Create an Instance: Create a new instance of the component class, providing any necessary configuration or pin assignments.</li><li>Interact with the Component: Use the methods and properties provided by the component class to control or retrieve data from the connected component.</li></ol><p>By following these steps, you can easily expand your Johnny-Five project and connect a variety of hardware components to unleash the full potential of your robotics or IOT application.</p><h3>Additional Resources</h3><p>To further enhance your Johnny-Five development skills, consider exploring the following resources:</p><ul><li>Official Johnny-Five Documentation: The official documentation is a comprehensive resource that covers all aspects of using Johnny-Five, including supported hardware components, API references, examples, and troubleshooting guides.</li><li>Johnny-Five GitHub Repository: Visit the Johnny-Five GitHub repository (<a href="https://github.com/rwaldron/johnny-five">https://github.com/rwaldron/johnny-five</a>) to access the source code, contribute to the project, or raise issues if you encounter any problems.</li><li>Online Tutorials and Projects: Explore online tutorials, articles, and projects shared by the Johnny-Five community. These resources provide practical examples, project ideas, and tips for building various robotics and IOT applications.</li></ul><p>Remember, the key to mastering Johnny-Five is practice and experimentation. Start small, gradually add new components, and enjoy the process of bringing your hardware projects to life using JavaScript.</p><p>This blog post serves as the first part of our comprehensive guide to Johnny-Five. We hope you found the information and code examples provided helpful in getting started with Johnny-Five, exploring its LED feature, and connecting new components. Stay tuned for the upcoming second part of this blog, where we’ll delve deeper into advanced functionalities and showcase more exciting projects you can build with Johnny-Five. Be sure to subscribe to our newsletter or follow us on social media to receive updates when the next part is released. Happy tinkering and stay excited for the next installment!</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27e8d3ea7238" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backend languages with declining use in 2023.]]></title>
            <link>https://medium.com/@VikashDevZ/backend-languages-with-declining-use-in-2023-1a33c9a50554?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a33c9a50554</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Thu, 25 May 2023 08:53:09 GMT</pubDate>
            <atom:updated>2023-05-25T08:53:09.233Z</atom:updated>
            <content:encoded><![CDATA[<p>While it is difficult to predict with certainty which backend language has the highest chance of becoming obsolete, there are some languages that have seen a decline in popularity and adoption in recent years. However, it’s important to note that even these languages still have existing codebases and communities that continue to use and maintain them.</p><ol><li><strong>Perl</strong>: Perl was once widely used for web development but has experienced a decline in popularity in recent years. It is primarily used now for system administration, text processing, and other specialized tasks.</li><li><strong>Visual Basic (VB.NET)</strong>: Visual Basic, particularly the VB.NET variant, has seen a decrease in popularity compared to other languages. It is less commonly used for new projects, with many developers migrating to more modern languages.</li><li><strong>Delphi</strong>: Delphi, a language based on Object Pascal, has experienced a decline in popularity over the years. It is mainly used for legacy projects and is less favored for new development.</li><li><strong>ColdFusion</strong>: ColdFusion, a server-side scripting language, has lost some popularity in recent years. However, it still has a dedicated user base and continues to be used in certain industries.</li><li><strong>Cobol</strong>: Cobol (Common Business-Oriented Language) is a programming language primarily used in legacy systems, particularly in the finance and government sectors. Its popularity has decreased over time as newer languages have gained prominence.</li><li><strong>Fortran</strong>: Fortran (Formula Translation) is a language commonly used in scientific and numerical computing. While it is still used in specific domains, its popularity has waned compared to more modern languages for general-purpose programming.</li><li><strong>Assembly Language</strong>: Assembly language is a low-level programming language that directly corresponds to machine code instructions. Its usage has diminished over time as higher-level languages and more abstracted development environments have become prevalent.</li><li><strong>ActionScript</strong>: ActionScript is a scripting language primarily associated with Adobe Flash. With the decline of Flash and the rise of alternative technologies for web and interactive content, the usage of ActionScript has significantly decreased.</li><li><strong>VBScript</strong>: VBScript (Visual Basic Scripting Edition) is a scripting language primarily used for automation tasks in the Windows environment. While it still has some use cases, its popularity has declined as developers have shifted to other scripting languages.</li><li><strong>RPG</strong> (Report Program Generator): RPG is a programming language commonly used for business applications, particularly in the IBM AS/400 (now known as IBM i) platform. Its usage has diminished as modern alternatives and web-based technologies have gained popularity.</li></ol><p>Again, it’s important to note that while these languages may have seen a decline in popularity, they still have existing code-bases and communities supporting them. Additionally, the choice of a backend language should be based on the specific requirements and constraints of your project, as well as the availability of resources and expertise in your development team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a33c9a50554" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Event Loop and Asynchronous Flow in Node.js]]></title>
            <link>https://medium.com/@VikashDevZ/understanding-the-event-loop-and-asynchronous-flow-in-node-js-c2859d6200b8?source=rss-2de9aa68e3ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2859d6200b8</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[event-loop]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[node-js-tutorial]]></category>
            <dc:creator><![CDATA[Vikash DevZ]]></dc:creator>
            <pubDate>Thu, 11 May 2023 09:48:26 GMT</pubDate>
            <atom:updated>2023-05-11T09:48:26.649Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction: Node.js is known for its ability to handle high-concurrency applications efficiently. This is largely due to its event-driven, non-blocking I/O model, which relies on the event loop and various queues to manage and execute asynchronous operations. In this blog, we will explore the inner workings of the event loop, event queue, callback stack, and microtask queue in Node.js, providing a comprehensive understanding of how these components interact to ensure smooth execution of asynchronous code.</p><p>Understanding the Event Loop: At the core of Node.js’ asynchronous architecture lies the event loop. The event loop is a mechanism that continuously checks for pending events and executes the corresponding event handlers. It follows a specific sequence of steps, known as the event loop lifecycle, to process these events and maintain the application’s responsiveness.</p><ol><li><strong>Phases of the Event Loop</strong>: The event loop in Node.js operates in a series of phases, each responsible for a specific set of tasks. These phases include:</li></ol><ul><li><strong>Timers</strong>: Handles the execution of timer callbacks scheduled using functions like setTimeout() and setInterval().</li><li><strong>I/O Callbacks</strong>: Executes I/O-related callbacks, such as network or file system operations, that have completed.</li><li><strong>Idle, Prepare</strong>: Internal phases for internal maintenance.</li><li><strong>Poll</strong>: Retrieves new I/O events and executes their callbacks. If no events are pending, it waits for events to arrive.</li><li><strong>Check</strong>: Executes setImmediate() callbacks scheduled during the poll phase.</li><li><strong>Close Callbacks</strong>: Handles close event callbacks, such as closing database connections or server instances.</li></ul><blockquote>Event Loop Lifecycle: The event loop follows a continuous cycle, iterating through the phases mentioned above. It starts with the timers phase and progresses through the remaining phases, ensuring that callbacks and events are processed efficiently. This cycle repeats as long as there are events to handle.</blockquote><p>Understanding the Event Queue and Callback Stack: To grasp how asynchronous code is executed in Node.js, it’s crucial to understand the concepts of the event queue and the callback stack.</p><ol><li><strong>Event Queue</strong>: The event queue, also known as the task queue, holds the callbacks and events waiting to be processed by the event loop. When an asynchronous operation completes or a timer expires, the corresponding callback is added to the event queue.</li></ol><p><strong>Callback Stack</strong>: The callback stack, also referred to as the call stack, keeps track of the execution context of the JavaScript functions. It follows the Last-In-First-Out (LIFO) principle, where the most recently added function is the first to be executed. When a function is invoked, it is pushed onto the callback stack. Once it completes, it is popped off the stack.</p><p><strong>Asynchronous Flow in Node.js</strong>:</p><p>Node.js provides various APIs that allow developers to write asynchronous code and manage the flow of execution. These include callbacks, Promises, async/await, and the microtask queue.</p><ol><li><strong>Callbacks</strong>: Callbacks are the traditional approach for handling asynchronous operations in Node.js. A callback function is passed as an argument to an asynchronous function and is executed once the operation completes. Callbacks can be error-first callbacks or plain callbacks, depending on the convention used.</li><li><strong>Promises</strong>: Promises provide a more structured way of handling asynchronous operations. A Promise represents the eventual completion or failure of an asynchronous operation and allows chaining multiple operations using then() and catch() methods.</li><li><strong>async/await</strong>: Introduced in ECMAScript 2017, async/await provides a more synchronous-looking syntax for handling asynchronous code. It allows developers to write asynchronous code that resembles synchronous code, making it easier to understand and maintain.</li><li><strong>Microtask Queue</strong>: The microtask queue, also known as the Promise queue, is where microtasks are queued for execution. Microtasks have a higher priority than regular tasks in the event loop and are executed before the event loop moves to the next phase. This ensures that microtasks are processed as soon as possible.</li></ol><p>The flow of asynchronous code in Node.js can be summarized as follows:</p><ol><li><strong>Asynchronous operation</strong>: When an asynchronous operation, such as a network request or file read, is encountered, it initiates the operation and registers a callback or returns a Promise.</li><li><strong>Callback/Promise resolution</strong>: Once the asynchronous operation completes, either the registered callback is added to the event queue or the Promise is resolved with the result.</li><li><strong>Event loop</strong>: The event loop continuously checks the event queue for pending callbacks or resolved Promises.</li><li><strong>Callback execution</strong>: When the event loop encounters a callback in the event queue, it is pushed onto the callback stack and executed. The callback may trigger additional asynchronous operations, continuing the flow.</li><li><strong>Promise handling</strong>: If a resolved Promise is encountered in the event queue, its associated then() or catch() handler is added to the microtask queue.</li><li><strong>Microtask execution</strong>: After the callback stack is empty, the event loop moves to the microtask queue and executes the handlers for resolved Promises. This ensures that microtasks are processed before moving to the next event loop phase.</li><li><strong>Repeat</strong>: The event loop continues its cycle, processing callbacks and Promises until all pending events and tasks are completed.</li></ol><p>It’s important to note that the event loop, event queue, callback stack, and microtask queue work together to provide the non-blocking, asynchronous behavior in Node.js. By efficiently managing these components, Node.js can handle a large number of concurrent operations without blocking the execution of other tasks.</p><p>Conclusion: Understanding the event loop, event queue, callback stack, and microtask queue is crucial for writing efficient and responsive asynchronous code in Node.js. By leveraging these components effectively, developers can harness the full power of Node.js’ event-driven, non-blocking I/O model.</p><blockquote>In this blog, we explored the inner workings of the event loop and the flow of asynchronous code in Node.js. We learned how the event loop progresses through various phases, how callbacks and Promises are handled, and the role of the microtask queue in ensuring timely execution of microtasks.</blockquote><p>By mastering these concepts, you’ll be well-equipped to write scalable and performant Node.js applications, effectively managing the asynchronous nature of the platform and delivering smooth and responsive user experiences.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2859d6200b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>