Arduino and ML8511 UV Detector

The sketch for this project can be downloaded from my GitHub page here.

UV

The ML8511 is a UV detector made by Lapis Semiconductor, it operates at 3.3 volts and has a maximum response at 365nm, covering UVA and UVB. Some versions of the breakout board, like the Sparkfun need to be operated at 3.3 volts, while others have a 5v to 3.3volt regulator. There are four connections Vcc (either 5v or 3.3v, check!), Gnd, Output and EN. For the ML8511 to operate it must be at 3.3 volts.

The ML8511 is a very accurate device and the output voltage is proportional to the UV light shining on it. The sketch I used, from Sparkfun, shows the UV intensity in milli watts per square centimeter.

Connections:

Connect Vcc to either 5 volts or 3.3 volts (Check board first!!), if your board can operate from 5 volts it will often have a pin marked 3.3 volts. This is an OUTPUT, do not connect 3.3 volts to this pin or you will probably burn the regulator. OUT is the signal output, connect this to Arduino pin A0. The last pin EN should be connected to the Arduino 3.3 volt pin, regardless of whether you power it from 5 volts or 3.3, finally connect the Arduino 3.3volt pin to Arduino pin A1. This 3.3 volts is very accurate and the output from the UV device will be compared with this to get an accurate reading.

The sketch:

Download the sketch from GitHub page here and upload to your Arduino, switch to the Serial Monitor (9600) to see the output.

This shows the output with a UV torch shining on the sensor.

UV2

This shows the output with no UV light on the sensor

UV1

ULN2003 Stepper Motor Driver with 28BYJ-48 motor

The 28BYJ-48 is a 5 volt stepper motor that is available cheaply  eBay. They normally come complete with a  ULN2003 Stepper Motor Driver board. This board has two power connections and four connections (IN1 to IN4) for the motor windings. For a number of reasons this motor will not run smoothly using the standard Arduino stepper motor driver library and after much searching on the internet I found a number of useful sites.

Neil Kenyon’s blog here goes into some depth on the inner workings of this motor and suggests an idea for  ‘end stops’ to ensure the motor starts in the correct position.This is an idea well worth implementing, for example I intend to make an Ultrasonic Radar (SONOR?) and need to make sure the Ultrasonic unit always scans the same area.

Stepper Motor Wiring

Neil Kenyon suggests using  AccelStepper but I felt this was a little over the top for what I wanted. I need to specify the number of steps, the direction of rotation and the speed of rotation. The first sketch I came across was at 4Tronix which used no library, but eventually I found the code for a simple library at engyfun.blogspot. This site listed the code for a simple library and a small sketch, I have packaged all the files into a standard library page that is available on m GitHub page here. My example sketch has expanded the original sketch to allow easier control from within a sketch.

Arduino and USB LED or Fan Driver.

usb driver

The sketch for this project can be downloaded from my GitHub page  here.

This simple board seems to be an opto isolator that can use the Arduino to drive a high brightness LED or fan. It comes in two parts the board with a USB socket and three pins to connect to the Arduino. A USB plug is fitted with two high brightness LEDS that can be used to test the board.

A simple sketch using PWM can be used. The board has three connections, Vcc, Gnd and signal. Connect Vcc to the Arduino 5 volts (or better a separate power supply). Connect Gnd to Arduino Gnd, also connect the Gnd of any external source to the Arduino Gnd. The signal pin needs to be connected to an Arduino pin that supports PWM, I used pin 3.

usb driver

I decided to add a single Capacitance switch to turn the LEDs ON and OFF and the Sketch for this project can be downloaded from my GitHub page here. The capacitance switch Vcc is connected to the Arduino 5 volts, Gnd to Arduino Gnd and the output pin is connected to Digital pin 4. Upload the Sketch Arduino_with_USB_LED_driver.ino touch the Capacitance switch and the LEDs will light, touch the switch again and the LED will go out.

An Arduino Nano or Pro Mini could be used to produce a small night light etc.

 

Arduino and Nokia LCD4884 display shield

LCD4884

This Nokia LCD4884 Arduino shield can be obtained from ebay at prices that range from £5 to £30. It comes in a number of variations, but all types are designed to plug straight on top of the Arduino and have a small joystick. Most also provide some pins to allow connection of sensors. Most Digital pins(D2 to D7) and one Analog pin (A0, used for the joystick) are used by the shield, and so not available for other use.

At least one supplier suggests that the device may not be compatible with Arduino 1.6 and above, but the library I found (from Yourduino) works perfectly with Arduino 1.65 and I have included this with the sketch on my Github page here.

The library provides two font sizes and the smaller font contains most characters and will print seven rows of thirteen characters. The larger font only has numeric, + and – characters, so would be ideal to display voltages etc.

Printing:

The library makes it easy to print Strings to the display, simply supply the x,y coordinates and the string

lcd.LCD_write_string(x, y, “string”, MENU_NORMAL);

to print inverse use

lcd.LCD_write_string(x, y, “string”, MENU_HIGHLIGHT);

Printing numbers requires some conversion. At the top of your sketch add

char temp[10];

then when you want to display a number

itoa(num,temp,10);

lcd.LCD_write_string(27, 18, temp, MENU_HIGHLIGHT);

where num is the number you want to print.

When using x and y to position the start of your printing of normal characters use y+9 to start on the next row and x+7 to start at the next character.

The Joystick:

The joystick will produce five voltage values (at A0) for position and one when the joystick is pressed. Values for my joystick are:

                    at rest — 1023

                    up ——  743

                    down —  330

                    left —–  0

                    right —-  508

                    pressed —  143

Example sketch:

Nokia LCD4884 1

Download the files from my Github page here. and install the library. save the sketch in a folder named Arduino_Nokia_LCD4884_clock and upload the sketch to an Arduino (Uno is OK). With the power off, plug in the shield, apply power and the display will flash a splash screen is displayed for a few seconds then the clock screen will be displayed.  Alongside the time display is a number showing the joystick output and this should be around 1023.

Move the joystick to the right and a cursor will move highlighting Set Hours. Press the joystick and the hours will flash (seconds stop counting) move the joystick up or down until the correct hour is shown. Move the joystick to the right and press down. The minutes will flash, set theses in the same way. Once the correct time is set move the cursor once more to the right and the clock will be in RUN mode (run shown in capital letters and no menu item highlighted.

The accuracy of this clock will not be brilliant as it is not controlled by an RTC but it does illustrate the principle of how to get the LCD4884 working.

Nokia LCD4884 2

The display in low light levels – note the annoying red power LED!

Conclusion:

Not the best of displays considering the cost, the backlight on mine consisted of four blue LEDs that only just illuminated the LCD but were bright enough to be distracting. As usual for shields like this it had a super bright red led to show power (as if the four blue LEDs didn’t show that power was connected!) that is very distracting. The display has very little contrast and can be difficult to read, but can show graphics of a sort. All in all its not very good, but at least it does not need too much programming to get it to work.

Arduino Talking GPS with WT588D -U32M

The sketch, library and WTD588D project files can be found on my GitHub page here. A talking clock using the same audio file can be found  here and a talking thermometer can be found here.

gps

There are several students at the school I work in who are partially sighted and I wanted to build several instruments that they could use that would allow them to be able to take part in Science experiments. A clock was chosen as a first project as it could be turned into a timer the second project is a talking thermometer and this third project is a talking GPS.

Getting the speech just right:

The biggest problem with getting this project right was to have as natural a voice as possible. I decided to produce a file that contained a range of words and phrases that would be useful in a range of measuring instruments. The result was the Talking Measurements file that contains a wide range of words suitable for a number of measuring instruments from Voltage and Current to GPS and Humidity. There is a list of phrases by measuring instrument in the text file Library List.txt.

The circuit:

This project uses an Arduino UNO, a WT588D -U 32M audio module and an RTC module DS1327. The clock has four connections, Vcc, Gnd, SDA (connected to A4) and SCL connected to A5. A simple push button switch is connected between digital pin 2 and Gnd, this is used to make the clock speak. The WT588D comes in several versions and the pin out for the -U version that has a USB connection is shown below.

FXP1VIHI5MD32NN.MEDIUM

Pin connections are looking down on the top of the module. Connect a small 8 ohm speaker to pins 9 and 10 and connect the module via a USB lead to a PC and startup the WT588D VoiceChip software.

waytronic2

If the program starts in Chinese click on the second menu item on the right and select English. Load the talking_measurements_winproj file using the Load a project button. Click on the compile button. Now click on the Options button and select Three Line Mode, PWM, Busy Mode – LOW and finally make sure Pull High Resistor is selected. Click on OK to exit the screen. Now click on the Upload to WT588D button, make sure the WT588D is connected to the PC, but not connected to the Arduino and click on the Connect button, the red light will turn green. To upload the audio to the WT588D click on the OneKeyDownLoad button, the green status bar will move across twice. On the second pass it should cross all the way over, if it stop about three quarters of the way over press the OneKeyDownLoad button again.

Once the audio file has been uploaded then connect the WT588D to the Arduino, the complete connection diagram for the talking GPS is shown below.

talking gps

The GPS uses TinyGPS++ and the library can be downloaded from here.Most GPS boards will work with this and I used the Adafruit Ultimate GPS. This board is powered by 5 volts and the signal pins (Tx and Rx) are 5 volt tolerant. Check your board it may need to be powered from 3 volts and need a logic level shift board to shift the Arduino pins 5 volts to 3 volts. The UBlox Neo6 is an example that can only work from 3 volts.

The Arduino Mega is not able to use all pins for Software Serial receive and as most of the lower pins are used to communicate with the WT588D -U32M I used pin 10 for Rx and pin 11 for Tx. The GPS Tx is connected to the Arduino Rx pin (pin 10) and the GPS Rx is connected to the Arduino Tx pin (Pin 11). Please note these are not the pins used in the examples provided in the TinyGPS++ library.

Connect the GPS unit and upload the sketch Arduino Talking GPS Using Talking Measurements.ino, once the GPS has a fix press the talk button. If all is well your position in degrees, minutes and seconds  for both latitude and longitude will be announced. The number of satellites in view and the current altitude will also be spoken.

It takes several seconds to talk through all the information, so if you are in a moving vehicle be aware that the location is the one at the start of the announcement, which (depending on the speed) may be different from the location at the end of the announcement!

The talking measurements project file for the WT588d has been updated to include more GPS phrases.

Connections:

Push Button = Arduino pin 2 and Gnd

GPS Module = GPS Gnd to Arduino Gnd, GPS Vcc to either 5v or 3v as required, GPS Tx to Arduino pin 10, GPS Rx to Arduino pin 11.

WT588D -U32M = pin 14 to Arduino Gnd, pin 20 to Arduino 5 volts, pin 7 to Arduino pin 3,  pin 21 to Arduino pin 4, pin 18 to Arduino pin 5, pin 17 to Arduino pin 6 and pin 16 to Arduino pin 7.

About Talking Measurements:

The WT588D is controlled using the  WT588D Library, but three subroutines are used to make the task of building sentences and speaking numbers easier.

speakPhrase(num) is used for sentance building, where num is the index number of the phrase required. Library List.txt lists the number for each phrase and is divided into measuring instruments. For example speakPhrase(136) will speak the time is.

speakNumber(int) will speak an integer from 0 to 9999

speakDecimal(num) will speak one decimal place from the decimal number num

So if num = 102.3

                                  speakNumber(num);

                                  speakDecimal(num);

 will speak one hundred and 2 point 3

if hour = 10 and min = 33 and its morning then

                                   speakPhrase(136); // speak the time is

                                   speakNumber(hour);

                                   speakNumber(min);

                                   speakPhrase(37); // speak AM

would speak the time is ten thirty three a m

Arduino Talking Thermometer with WTD588D -U 32M

The sketch, library and WTD588D project files can be found on my GitHub page here. A talking clock using the same audio file can be found  here

talking thermometer project

There are several students at the school I work in who are partially sighted and I wanted to build several instruments that they could use that would allow them to be able to take part in Science experiments. A clock was chosen as a first project as it could be turned into a timer and this second project is a talking thermometer.

Getting the speech just right:

The biggest problem with getting this project right was to have as natural a voice as possible. I decided to produce a file that contained a range of words and phrases that would be useful in a range of measuring instruments. The result was the Talking Measurements file that contains a wide range of words suitable for a number of measuring instruments from Voltage and Current to GPS and Humidity. There is a list of phrases by measuring instrument in the text file Library List.txt.

The circuit:

This project uses an Arduino UNO, a WT588D -U 32M audio module and an RTC module DS1327. The clock has four connections, Vcc, Gnd, SDA (connected to A4) and SCL connected to A5. A simple push button switch is connected between digital pin 2 and Gnd, this is used to make the clock speak. The WT588D comes in several versions and the pin out for the -U version that has a USB connection is shown below.
FXP1VIHI5MD32NN.MEDIUM

Pin connections are looking down on the top of the module. Connect a small 8 ohm speaker to pins 9 and 10 and connect the module via a USB lead to a PC and startup the WT588D VoiceChip software.
waytronic2
If the program starts in Chinese click on the second menu item on the right and select English. Load the talking_measurements_winproj file using the Load a project button. Click on the compile button. Now click on the Options button and select Three Line Mode, PWM, Busy Mode – LOW and finally make sure Pull High Resistor is selected. Click on OK to exit the screen. Now click on the Upload to WT588D button, make sure the WT588D is connected to the PC, but not connected to the Arduino and click on the Connect button, the red light will turn green. To upload the audio to the WT588D click on the OneKeyDownLoad button, the green status bar will move across twice. On the second pass it should cross all the way over, if it stop about three quarters of the way over press the OneKeyDownLoad button again.

Once the audio file has been uploaded then connect the WT588D to the Arduino, the complete connection diagram for the clock is shown below.

talking thermometer

The DS18B20 thermometer can be purchased in a number of forms. I have chosen the sealed version that is fitted with about 500mm of cable. It must have a 4K7 resistor fitted between the data line and Vcc and although it can be operated in a two wire mode it is faster when connected with all three wires. The resolution can be set and the more accurate the reading is the slower it is to send the data. By setting the resolution to 12 (as I have done here) the resolution is 0.1C, this slows things down a little and needs a long press on the button to talk the temperature. Setting the resolution to 9 will give a resolution of 0.5C and the button only needs to be pressed quickly to get it to talk.

If the temperature is changing quickly the spoken temperature my differ from the displayed temperature, but the device will always speak the temperature that was present the moment the button is pressed

Talking Measurements:

The audio file in the WT588D project file contains a wide range of words and phrases useful for measuring devices and a list is included in the GitHub files. The sub routines will speak a 4 digit integer and a four digit decimal number with two decimal places. Minus numbers are also spoken.