Simple Water Detection Circuit

As part of a project to make DIY water activated diving flashing marker, I needed a simple circuit to detect when the marker is in contact with water. Turns all all it takes to do that is a a couple of basic components. Here is the diagram; P1 and P2 are the probes that will be in contact with water: Water detection circuit ...

December 29, 2018 · 2 min · 274 words · Stan

ESP8266 example: Wi-Fi Access point, static IP, web-server and remote GPIO control

After testing the basic Wi-Fi connectivity options of the ESP8266 it is now time to explore some of the more interesting features of the chip. In the sketch below the NodeMCU development board creates a Wi-Fi access point and starts a web-server. A HTML page hosted on the web-server displays analog data from a photocell and allows you to control remotely a LED via Wi-Fi from a web-browser on your phone or PC. As in the previous examples, I am using the Arduino IDE to program the ESP8266 board. ...

May 3, 2017 · 6 min · 1203 words · Stan

ESP8266 Wi-Fi tutorial and examples using the Arduino IDE

In the following examples, I will be using the NodeMCU development board and will program it with the Arduino software. Hopefully you have already set-up your ESP8266 development environment and were able to load the blink sketch. If not please follow this tutorial first. ESP8266 WiFi station mode example The ESP8266 can communicate over WiFi in two different modes. It can connect to an existing wireless hot spot, or access point, similar to the way you connect your phone or computer to the Internet. This is called “station” mode. In station mode the ESP8266 board can reach out to the internet and may also communicate with other devices connected to the same network, including other ESP8266 modules. Here is a simple example. Remember to replace the values for the ssid and password variables with the name and password for your wireless network! ...

May 2, 2017 · 5 min · 856 words · Stan

How to program the ESP8266 WiFi Modules with the Arduino IDE (Part 2 of 2)

Part 1 of this tutorial covers the set-up of the Arduino IDE to support the ESP8266 boards. In part 2 I will go through the steps of loading a slightly modified Blink sketch to the NodeMCU board. First, a couple of things to be aware of when working with the ESP8266 boards: Power: ESP8266 is a 3.3v board The NodeMCU version of the board has an on-board 3.3v voltage regulator and can be powered from the USB port (5V), or through the vin pin (5-7.5v recommended). All GPIO pins work at 3.3v and the board may be damaged, when connected directly to 5v Arduino compatible modules. Additionally, the maximum current that can be sourced from a digital pin is 12 mA. Use a high value resistor for LEDs (1k Ohm) and do not connect servos, motors, or other peripherals that draw large current. ...

April 14, 2017 · 5 min · 855 words · Stan

How to program the ESP8266 WiFi Modules with the Arduino IDE (Part 1 of 2)

I have recently started exploring an ESP8266 based development board I had sitting around. There is a growing number of firmware and development tools for the board, but as I am familiar with the Arduino IDE and syntax, I decided to give it a shot first. If you are familiar with Lua, you might be more comfortable checking out the NodeMCU project. Those guys created an open source hardware development board around the ESP8266 MCU with included USB interface for easy programming and power and custom firmware and development tool-chain to program the ESP8266 module using Lua. ...

April 11, 2017 · 4 min · 654 words · Stan

Programming ATtiny ICs with Arduino Uno and the Arduino IDE 1.6.4 or above

In previous posts I covered the steps on programming ATtiny85 and ATtiny84 chips using an Arduino Uno as programmer and the Arduino IDE Software with two different “libraries”. At that time the process of adding new boards to the Arduino IDE was fairly complicated and manual. As of version 1.6.4 of the Arduino IDE, the “Boards Manager” has been added, which makes adding third party boards (like the ATtiny) much easier. The awesome guys at the MIT Labs High-Low tech group have created the required file for the ATtiny ICS (ATtiny85, 45, 84 and 44) and provided installation instructions on their site. The video tutorial below covers the steps from setting up the Arduinp IDE and configuring the Arduino Uno to act as a programmer, through wiring the ATtiny to the Arduino, uploading a test sketch (“blink”, of course) and configuring the ATtiny to use its internal 8 Mhz clock. ...

November 24, 2015 · 2 min · 269 words · Stan

Arduino script for MPU-6050 auto-calibration

I while back I did some work on a self-balancing robot using and Arduino Uno and the InvenSense MPU-6050 6DOF sensor. Using the sensor is easy, thanks to Jeff Rowberg’s I2Cdev library and sample code. If you look around line 200 of the MPU6050_DMP6 example arduino sketch that comes with the library you will see the following: // supply your own gyro offsets here, scaled for min sensitivity mpu.setXGyroOffset(220); mpu.setYGyroOffset(76); mpu.setZGyroOffset(-85); mpu.setZAccelOffset(1788); // 1688 factory default for my test chip I did some further reading on the I2CDev forum and found several threads on calibrating the MPU-6050 sensor and determining the optimal offsets. These, apparently, are specific to your device, as well to the exact orientation of the module, once it is installed. I found a significant improvement using the script by Luis Rodenas attached to this forum thread. Below is the Arduino sketch version 1.1 (the most current at the time of this post). For best results, mount your module and run the script, while you have it stable in the position you will use it. For example, on a self balancing robot, have the robot upright in the optimal balanced position and keep it steady while the script completes and you see output with the suggested offsets. You then need to copy these offsets and overwrite the defaults in the sample code (around line 200, as mentioned above). ...

September 27, 2015 · 8 min · 1571 words · Stan

Access your Raspberry Pi Terminal and Graphical Desktop remotely using SSH and VNC

This post will cover the steps necessary to set-up remote access to the Raspberry Pi terminal and graphical desktop environment from a Windows, or Linux PC. I do not have a Mac, but the steps should be very simillar. In some posts this is referred to as running your Raspberry Pi “headless”. I want to put my Raspberry Pi 2 on a small mobile robot platform, so I can’t have it drag a mouse, keyboard and monitor around. The steps below will work for Raspberry Pi models B, B+ and 2. ...

April 8, 2015 · 13 min · 2710 words · Stan

Raspberry Pi 2 Initial set-up and configuration with NOOBS / Raspbian

Unlike the Arduino, the Raspberry Pi is not a micro-controller, but rather a small, bare-bones computer that needs an operating system in order to run. The most popular OS for the Raspberry Pi currently is a version of Linux, called Raspbian, specifically optimized for its hardware. I plan to use Raspbian exclusively on my new Raspberry Pi 2 and this posts assumes you will be too. Things you will need to set-up your Raspberry Pi 2: A computer with internet access to download the required software for the Raspberry Pi. An 8 gig (for some extra space, a 4 gig one should work too) Micro SD card. You also need a way to write to the card either by using the SD card slot in your laptop, or a USB SD/Micro SD Card Reader/Writer. A HDMI display (computer monitor, or TV) and an HDMI cable. A DVI display will work as well, if you have a HDMI to DVI cable/adapter. A USB keyboard and a USB mouse. Wireless ones will work most of the time, but if you run into problems, try the “old school” wired versions. After the initial set-up, you can configure remote access to your Raspberry Pi, from another computer and drop the peripherals and the extra monitor. 5 Volt micro USB power supply that can provide at least 1.2 A, with a 2.5 A recommended if you plan to use all 4 USB ports of the Pi. Here is more info on the Raspberry Pi power requirements. Internet connection via an Ethernet cable, or a WiFi adapter to update the software. One of my two WiFi adapters did not work with the Pi, so I recommend to use the Ethernet cable for the initial set-up. I will cover the WiFi configuration in a follow-up post. Formatting the SD Card The Micro SD card for the Raspberry Pi 2 needs to be formatted using the FAT32 format. To do that you can use the SD Formatter program by SD Associates, available for Windows and for Mac. For Linux, the Raspbian.org start-up guide recommends GParted, a free application for managing disk partitions using a graphical interface. On my old Ubunto laptop, I had to install the package with “apt-get” and run it as administrator. ...

March 23, 2015 · 8 min · 1493 words · Stan

Bipolar stepper motor control with Arduino and an H-Bridge

It is a well known fact that Stepper motors are awesome! The only downside is that they can be a bit trickier to get going than servos and plain old DC motors. If you are interested in the inner mechanics and theory of stepper motors, check this excellent post on PCB heaven. If you happen to have one of the cheap little 28BYJ-48 steppers with 5 wires and a little driver board with them, check this tutorial instead. Here, I will focus on how to get a bipolar stepper motor (typically 4 wires) working with Arduino and a H-Bridge IC like the L293D , or the drop in improved replacement – SN754410NE . ...

December 2, 2014 · 9 min · 1799 words · Stan