26
Jun

Welcome To My Arduino Blog


If you don't know what Arduino is, start here: Arduino site

Google it and you'll find a plethora of information and project sites. It's quite a remarkable little piece of "open hardware" electronic awesomeness that inspires unrelentingly. If you're a hack like me you won't be disappointed. Powerful for its size and cost, and extemely easy to learn and use.

Please register using the Log In link in the upper right corner. Feel free to leave comments by clicking on the post title.

My projects...

Scooterputer

Mobile Sun Tracking Solar Power Plant

New Tech Firma web site - get Scooterputer here!


Scooterputer is a trademark of Tech Firma, LLC


free b2evolution skin
26
Jun

Scooterputer

Scooterputer Image


I spend a fair amount of time zipping around town on my scooter, and thought it would be cool to add a voltage monitor to warn when the battery might need recharging. Waiting until the electric starter no longer works is somehow lacking. So after an evening with an Arduino Duemilanove, I had a simple programmable voltage divider with 3 LEDs indicating battery low, good, and charging. Done.

That's when I saw Liquidware's very cool TouchShield Slide OLED display with touch screen. It was telling me it wanted to be on my scooter. It's a bit overkill for just battery status, so I added temperature and time/date readouts. I went to Sparkfun.com and found a DS18B20 temperature sensor and a DS1307 RTC chip. Perfect. Oh wait, what's this...an accelerometer? Sweet! Hey, a GPS chip...

So a few weeks later, here's what my battery voltage indicator is looking like:

Scooterputer Display


You can see in the first photo that the TouchShield display is separated from the Duemilanove / Cell Module / Sensor shields. These are installed "under the hood" of my scooter and provide power and signals to the display module via a standard 8-wire ethernet cable. This keeps the sensors (accelerometer, GPS, cell module, etc.) with the scooter making it functional even without the removable external display, as we'll see later. (NOTE: this photo was taken before the display was fully mounted inside the enclosure, and is shown without the protective rubber boot.)


Features

  • Battery voltage indicator
  • Time and date
  • Temperature
  • Lean gauge with resettable max L-R indicators
  • Current speed
  • Resettable max speed indicator
  • Odometer
  • 2 resettable trip meters
  • Latitude and longitude readouts
  • Compass heading readout
  • GSM/GPRS quad-band cellular module


Schematic


Visual Schematic


Sensor Shield


The sensors are mounted on a Proto Shield PCB from Ladyada's Adafruit Industries (which is also where I get my Duemilanoves). Most of the wiring was done using 30 gauge Kynar solid wire, with heavier gauge used for some power and ground connections. Good mechanical connections are important considering the shock and vibrations this will be subjected to.

Sensor Shield - Top
Sensor Shield - Top

Sensor Shield - Bottom
Sensor Shield - Bottom

I went with breakout boards for the surface mount chips. They take up a bit more real estate on the PCB but are very easy to solder and save a lot of construction time. Note the DS1307 RTC on the underside...the profile is still low enough to allow the parts to fit nicely in the open space between boards when stacked. I soldered a right-angle pin header directly to the pads of the GPS breakout board, and straight pin headers on the others.

GPS/RTC Breakout
GPS/RTC Breakout

You might be wondering why I even included the RTC chip since time-of-day and date can be gotten from the GPS data. The DS1307 RTC chip also has 56 bytes of non-volatile RAM. I'm using these registers for storing the trip meter and odometer values so they can be restored between power cycles.

The GPS uses pins 0 and 1 for its TxD and RxD signals to communicate to the Duemilanove. The TouchShield Slide also uses these pins for downloading sketches. The "Program Switch" is used to disconnect the TouchShield Slide from these pins when not downloading so they're free for use by the GPS. Fortunately the TouchShield Slide uses pins 2 and 3 during normal operation, which I'm driving with digital I/O pins 4 and 5 on the Duemilanove.

Three devices require serial communications (GPS, TouchShield Slide, and Cell Module), and it was a real challenge getting the Duemilanove to support these at data rates needed for the desired performance. Having the GPS, running at 9600 baud, use the hardware serial port (pins 0 and 1) proved to be the best approach. The TouchShield Slide (19200 baud) and Cell Module (4800 baud) use digital I/O pins, and Mikal Hart's NewSoftSerial library for 'software' interrupt driven serial communications was invaluable in getting these to play nicely together.

The GPS chip is powered by the 3.3v regulator. The 10k resistor and 1N914 diode circuit on the serial RxD line of the chip are used to dampen the 5v signal from the Arduino hardware TxD line used to send data to the chip. When that line is high, the diode doesn't conduct allowing the 10k pull up resistor to apply a 3.3v high to the GPS RxD input. When it's low, the diode conducts and the line sinks through the TxD driver pulling the line down. The .7 volt drop across the diode is still sufficient for a low to be recognized by the GPS RxD input. A schottky diode with a .2v drop might be an improvement here, but the 1N914 seems to work fine. The GPS is rarely receiving data anyways - data is usually sent only one time to initialize the NMEA sentences to be sent, the baud rate, and the update cycle rate.


Display


The TouchShield Slide is mounted on another Proto Shield PCB. The CAT-5 connector is wired to the PCB using solid telephone wire to provide power and ground, and to connect the RxD and TxD signals from the Duemilanove to the display. Another line is brought up to drive the beeper.

Display Shield
/DisplayShield 2

/DisplayShield 3

The display assembly is mounted in an enclosure I found at boxenclosures.com, part #40-12-NO-R-BL. It's a perfect size for the TouchShield Slide, once the inside bosses were removed with a Dremel tool. I cut out an opening for the display/touchscreen using a plastic cutter tool, and added a 1/16" gasket I cut from a sheet of neoprene to seal it.

Box Enclosures also has a nice protective rubber boot for the enclosure, which is shown in the scooter photos below.

Display Enclosure With Gasket
/DisplayShield 5


Cell Module


The SM5100B GSM/GPRS Cell Module just needs a SIM card and antenna. The antenna can be obtained from Sparkfun.com and attaches to the wire with the red cap covering the connector.

Cell Module
Cell Module

The Cell Module shield and Sensor shield plug in to the Duemilanove, stacked one on the other. The Duemilanove is programmed to reply to text messages made to the cell with a return text message containing latitude/longitude data, heading, speed, and a time stamp. The GPS latitude and longitude coordinates can be entered online to see the location on a map, such as using touchmap.com. I can also use this to capture my precise location when riding in an unfamiliar area. One of the spare buttons on the display could be used to tell the Scooterputer to text a cell phone with this information.

The Duemilanove is also programmed to send the text message to my cell phone when it initializes. This serves as kind of a scooter "LoJack". If the scooter is ever borrowed without permission, it will notify me each time it starts, and as long as it is running it can be texted to obtain its present location. Recovery and bad-guy-in-jail are just a text message away. Of course now my wife can text my scooter any time she wants to find out what I'm up to (note to self: add a pass phrase to the incoming message).

I also have it programmed to forward any incoming calls to my personal cell.

The display is not needed for any of these features. Also note that the Cell Module is optional. The Sensor shield can be plugged directly into the Duemilanove if the telecommunication features are not desired.

Duemilanove/Cell/Sensor
Duemilanove/Cell/Sensor


Calibrating


Very little is needed for calibration. Check out the source code to see how simple it is. Debug #defines are included to selectively send the sensor values to the Arduino serial monitor during operation. The scaling and mapping can then be tweaked as needed while observing the output.

The ranges for the accelerometer readings are easily obtained by analyzing the analog input data. I found full range to be 453 to 580 for both the X and Y axis, which is 127 units with a center around 516. I arbitrarily took 20 off each end and mapped these to -90 to +90 for the Lean Gauge values.

The Lean Gauge display is designed to show the current real time values in bright green, and the max L-R readings are maintained on the background in dark green. These can be reset by pressing the Lean button on the display.

The Battery Voltage Indicator ranges were set by varying the voltage applied from a bench power supply. The top of the indicator is calibrated to 14.0v and the bottom 10.0v, again by mapping the values coming in the analog input to the 0 - 100 range expected by the Battery Voltage Indicator. With a strong battery, at idle the indicator floats within the green zone and at speed it just gets into the orange. When the battery is weak and the indicator falls into the red zone, the red area flashes at a 500 msec rate from bright red to dark red.

Calibrating The Battery Voltage Indicator
Calibrating BVM


The Haversine formula is used to calculate the distance traveled for the odometer and trip meters, using lat/lon data returned from the GPS. This seems to track the odometer on the scooter fairly close as long as I'm not riding in tight circles or zigzags. Since I don't ride while intoxicated, this should work fine for the trip meters but I have my doubts about the long term accuracy for use as an odometer. Time will tell, and I expect I'll be tweaking the algorithm to calibrate for improved accuracy.

As an alternative, I experimented some with a hall-effect sensor triggered by a magnet attached to the wheel. I'm confident this would be very effective as a speedometer and odometer, but have decided to go strictly with the GPS for now. If you're interested, let me know and I can post the hall-effect sensor circuit and sketch. (Update 08/25/2010: added link below to circuit diagram and test sketch)


Source Code and Antipasto IDE

Scooterputer.zip - sketches for Arduino Duemilanove and TouchShield Slide

Liquidware Antipasto - Antipasto Arduino IDE (supports Arduino Duemilanove and TouchShield Slide)

HallEffectSensorTest.zip - circuit and test sketch for Hall Effect sensor


Scooter

Scooterputer Mounted Under The Hood
Scooter Under Hood 1

Scooterputer Mounted Under The Hood
Scooter Under Hood 2

Scooterputer Display with RAM Mount
Scooter Display RAM Mount

Scooterputer Display
Scooter Display

Scooter Walkaround


Links


www.arduino.cc - start here
www.adafruit.com/ - get lots of great Arduino stuff here. Ladyada rocks!
www.liquidware.com - TouchShield Slide
www.liquidware.com/antipasto_arduino_ide - Antipasto Arduino IDE
www.sparkfun.com - components: accelerometer chip, GPS chip, RTC chip, temperature sensor, cell module, and much more
www.boxenclosures.com/index.html - nice project cases
arduiniana.org - NewSoftSerial and TinyGPS libraries. Mikal rocks too.
itouchmap.com/latlong.html - mapping GPS coordinates
www.hhhh.org/wiml/proj/nmeaxor.html - NMEA sentence checksum calculator
www.movable-type.co.uk/scripts/latlong.html - useful latitude/longitude formulas
www.ram-mount.com - mounting systems for cars, motorcycles, scooters, ATVs, etc.
www.genuinescooters.com - awesome scooters!


Now you can have your own...

Scooterputer & GLCD

Scooterputer


Scooter. Motorcycle. Snowmobile. ATV. Boat. E-Bike. Pop this sensor packed shield onto an Arduino microcontroller for a powerful, high tech dash for your ride. Visit the Tech Firma web site to learn more about our Scooterputer Sensor Shield, sunlight readable graphic LCD displays, mobile apps, and more. Open source hardware and software - make it your own!

Scooterputer is a trademark of Tech Firma, LLC


free b2evolution skin
13
Jul

Mobile Sun Tracking Solar Power Plant

Solar Tracker


A recent storm with horrific winds took down our electrical power. The outage was widespread, straining the power company to get everyone back online. We were without power for almost 3 days - no heating, no hot water, no refrigeration, no range, no microwave, no lighting. No TV, no WiFi, and no hot coffee in the morning. And we were the lucky ones; many were blacked out for over a week. Time for a backup plan.

My first thought was to buy a gas-powered generator. Plenty of backup power but with one problem; it's gas-powered. Big, heavy, noisy, lots of exhaust, and not exactly eco-friendly. And it uses fuel which may be scarce when, for instance, zombie hordes rule the land. I wanted something that would provide efficient power indefinitely, without burning up the gas. Something mobile and quiet I could use while camping as well as emergency backup. Something like a small solar power plant.


Features

  • Sun Tracking Sensor
  • Renogy 50W Monocrystalline Solar Panel
  • Renogy 30A PWM Charge Controller
  • 85AH Deep Cycle Gel Batteries
  • 2000W DC-AC Power Inverter With 3 AC Outlets
  • Bussmann 150A Resettable Circuit Breaker
  • Servo Motor for Azimuth Axis
  • Linear Actuator for Elevation Axis
  • Arduino UNO Controller
  • Adafruit Motor Shield v2
  • Backlit LCD Voltage Meter
  • Adjustable LED Bar Work Light
  • 12VDC Switched Outlet With 15A Resettable Circuit Breaker
  • USB Charging Outlet
  • Durable Battery Box With Carrying Handles



Schematic


Visual Schematic-PowerPlant

Visual Schematic-Arduino


Solar Panel With Sun Tracking Sensor


After a little research I found that a solar panel tracking the sun from morning through evening is much more efficient than a fixed panel. Estimates range from 35% to 50% higher efficiency using dual-axis tracking. The expense to implement sun-tracking can get quite high however, especially for larger systems. Given that only one medium-sized solar panel was going to be used for this project, I decided sun-tracking was needed to get maximum efficiency. Besides, tracking the sun makes for a more fun project.

A servo motor geared for high-torque controls the azimuth positioning of the solar panel, and a 12VDC linear actuator controls the elevation. Both of these were purchased from Servo City along with the aluminum tubing, brackets, and mounting hardware. The servo and linear actuator are driven by an Arduino UNO microcontroller using the Adafruit Motor Shield, and powered by the deep cycle Gel batteries.

The sun-tracking sensor is made from a cheap 6-LED flashlight. I picked up a pack of 4 of these for less than 6 bucks at the local hardware store. I removed the LEDs from one of the flashlights, cut some tracks, then soldered in 3 LDR photo sensors arranged in a triangle. These are separated by "shades" cut from a black vinyl plastic sheet that were shaped and welded together using a heat gun as shown in the photos.

The LDRs are connected via a 4-conductor cable to analog input pins A0, A1, and A2 of the Arduino; azimuth is determined by the light levels sensed by two of these side-by-side, and elevation is determined by averaging the levels of those two and comparing to the light sensed by the third LDR positioned below them. This arrangement allows the Arduino to orient the face of the solar panel towards the direction with the most light by driving the servo and linear actuator. At night, the Arduino automatically positions the solar panel to face east in anticipation of the morning sunrise. The end of a clear polypropylene test tube protects the LDR photo sensors, with a small hole drilled in the bottom to help prevent it from fogging.

The Arduino communicates with the Adafruit Motor Shield using I2C over pins A4 (SDA) and A5 (SCL). The servo motor is controlled using an output from the Arduino on pin 9. The linear actuator has a built-in potentiometer for indicating its position. One end (yellow wire) of the pot resistor is connected to +5v. The other end is tied to the wiper (white and blue wires) which are then connected to pin A3 through a 10k resistor, forming a voltage divider allowing the Arduino to sense the position of the actuator.

The metal bracket covering the base of the solar unit is a custom piece I created with eMachineshop. It has slots that fit snugly around the screw heads on the legs, allowing it to securely snap into place.

Low-Cost 6-LED Flashlights
LED Flashlights

Hacking The Flashlight

Disassembled Flashlight LDRs replaced LEDs
PVC Dowel Sensor Head



Battery Power Pack


An Attwood Power Guard 27 box was the perfect size to house the two 12V deep cycle Gel batteries; one 50Ah and one 35Ah wired in parallel for a total of 85Ah. These are kept charged by a Renogy 30A PWM Charge Controller connected to the Renogy 50W monocrystalline solar panel via a 20 foot cable with MC4 connectors, as shown in the video.

A 2000W DC-AC power inverter is connected to the batteries through a Bussmann 150A resettable circuit breaker. The power inverter provides 120VAC to three outlets and a USB outlet handy for charging cell phones, GPS trackers, and tablets.

The Renogy Charge Controller and the power inverter are bolted directly to the sides of the Attwood battery box to keep everything together, making it easy to carry.

A sunlight-readable backlit LCD meter is also mounted to one side of the battery box, along with rocker power switch, a sealed marine 12VDC outlet, and an adjustable LED bar work light.

I deliberately avoided mounting any components to the lid of the battery box so it could be removed freely, allowing the 20ft cables that connect to the solar panel unit to be stored in the box as shown in the video.

Wiring

Wiring Wiring
Wiring Power Pack



Mobility


I'm happy with the compactness of the battery power pack. Housing 85Ah at 12VDC for 1KWh of power, a 2000W power inverter, a charge controller, a voltage meter, an LED light bar, multiple outlets with circuit breakers, as well as all cables in such a small space is extremely convenient for portability.

However...this thing is HEAVY! At 58 lbs. I won't be taking it backpacking anytime soon. But the handles do make it fairly easy to carry even if getting a tad winded, and I wouldn't hesitate to throw it in the back of my Jeep to take on a camping trip. And it is still very easy to move and set up for emergency backup at the house. Although I would put it on wheels if I had to lug it more than a couple hundred yards - maybe in a wheeled cooler or on a luggage wheeler. Still, beats dragging around a heavy gas generator with fuel hands down.

The solar panel unit is much lighter at 15.2lbs but a bit more awkward to carry and would take a fair amount of space in the back of the Jeep. I've considered modifying the design to allow the panel to be easily removed, and collapsible or removable legs would probably also help make it easier to transport. I wouldn't call it fragile, but obviously it's not as rugged as the battery power pack.

One other complaint: the screw terminals on the Renogy Charge Controller are under-sized. They're almost too small to capture the #10 MC4 cable reliably, and I always make sure to have a screwdriver on hand to tighten up when needed.



Schematics


Solar Power Schematics (PDF) - Mobile Sun Tracking Solar Power Plant Schematics


Source Code


SolarTracker_Rev_2.zip - Arduino Sketch


Video


Links


www.arduino.cc - Arduino main site
www.adafruit.com/products/1438 - Adafruit Motor Shield v2
www.renogy-store.com/MonoCrystalline-Solar-Panel-s/1831.htm - Solar panel
www.renogy-store.com/30-amp-charge-controller-p/ctrl-pwm30.htm - Charge Controller
www.harborfreight.com/2000-watt-continuous4000-watt-peak-power-inverter-69662.html - 2000W Power Inverter
www.servocity.com/ - Servos, linear actuators, motors, mechanical parts


Post nubila maxima, Phoebus


free b2evolution skin
25
Nov

New Web Site!

Link: https://www.techfirma.com


Now you can have your own...

Scooterputer & GLCD

Scooterputer


Scooter. Motorcycle. Snowmobile. ATV. Boat. E-Bike. Pop this sensor packed shield onto an Arduino microcontroller for a powerful, high tech dash for your ride. Visit the Tech Firma web site to learn more about our Scooterputer Sensor Shield, sunlight readable graphic LCD displays, mobile apps, and more. Open source hardware and software - make it your own!


free b2evolution skin