Arduino Software Interrupt
Posted in HomeBy adminOn 27/11/17Kurts Arduino Projects. 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. Thats when I saw Liquidwares very cool Touch. Shield Slide OLED display with touch screen. It was telling me it wanted to be on my scooter. MQM.png' alt='Arduino Software Interrupt' title='Arduino Software Interrupt' />Its a bit overkill for just battery status, so I added temperature and timedate readouts. I went to Sparkfun. DS1. 8B2. 0 temperature sensor and a DS1. RTC chip. Perfect. Software Wifi Free. Oh wait, whats this. Sweet Hey, a GPS chip. So a few weeks later, heres what my battery voltage indicator is looking like You can see in the first photo that the Touch. FQH/1LBA/H8CVFUMB/FQH1LBAH8CVFUMB.MEDIUM.jpg' alt='Arduino Software Interrupt' title='Arduino Software Interrupt' />Shield 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. 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 GSMGPRS quad band cellular module Schematic. Sensor Shield. The sensors are mounted on a Proto Shield PCB from Ladyadas Adafruit Industries which is also where I get my Duemilanoves. Most of the wiring was done using 3. Kynar solid wire, with heavier gauge used for some power and ground connections. We have just release the 1st revision of our low power library for Arduino. This is a simple and easy to use library that has the following features. Good mechanical connections are important considering the shock and vibrations this will be subjected to. Sensor Shield Top. 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 DS1. 30. An overview of basic interrupts on the Arduino and how to use them to handle precise timing and input events. In this tutorial, learn about AVR and Arduino timers and how to use them to write better code. Find more details, circuit schematics and source codes on my official webs. MsTimer2 is a small and very easy to use library to interface Timer2 with humans. Its called MsTimer2 because it hardcodes a resolution of 1 millisecond on timer2. RTC on the underside. I soldered a right angle pin header directly to the pads of the GPS breakout board, and straight pin headers on the others. GPSRTC 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 DS1. 30. 7 RTC chip also has 5. RAM. Im 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 Tx. D and Rx. D signals to communicate to the Duemilanove. The Touch. Shield Slide also uses these pins for downloading sketches. The Program Switch is used to disconnect the Touch. Shield Slide from these pins when not downloading so theyre free for use by the GPS. Fortunately the Touch. Shield Slide uses pins 2 and 3 during normal operation, which Im driving with digital IO pins 4 and 5 on the Duemilanove. Three devices require serial communications GPS, Touch. Shield Slide, and Cell Module, and it was a real challenge getting the Duemilanove to support these at data rates needed for the desired performance. Arduino_IDE_-_Processor_ATtiny85_1024x1024.png?v=1490045540' alt='Arduino Software Interrupt' title='Arduino Software Interrupt' />Having the GPS, running at 9. The Touch. Shield Slide 1. Cell Module 4. 80. IO pins, and Mikal Harts New. Soft. Serial library for software interrupt driven serial communications was invaluable in getting these to play nicely together. The GPS chip is powered by the 3. The 1. 0k resistor and 1. N9. 14 diode circuit on the serial Rx. D line of the chip are used to dampen the 5v signal from the Arduino hardware Tx. D line used to send data to the chip. When that line is high, the diode doesnt conduct allowing the 1. GPS Rx. D input. When its low, the diode conducts and the line sinks through the Tx. D driver pulling the line down. Arduino Software Interrupt' title='Arduino Software Interrupt' />The. GPS Rx. D input. A schottky diode with a. N9. 14 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 Touch. Shield 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 Rx. D and Tx. D signals from the Duemilanove to the display. Another line is brought up to drive the beeper. Display Shield. The display assembly is mounted in an enclosure I found at boxenclosures. NO R BL. Its a perfect size for the Touch. Shield Slide, once the inside bosses were removed with a Dremel tool. I cut out an opening for the displaytouchscreen using a plastic cutter tool, and added a 11. 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. Cell Module. The SM5. B GSMGPRS Cell Module just needs a SIM card and antenna. Download Teensyduino, Version 1. Teensyduino is a software addon for the Arduino software. We have designed the Arduino CNC Shield to use all the pins that GRBL implemented. We have also added a few extra pins to make things a little easier. Hi everybody So recently i was working on a Project where i wanted to meassure the RPM of one of the Wheels on my Car, and from that calculate the Speed, keep. The antenna can be obtained from Sparkfun. 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 latitudelongitude 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. 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 Lo. Jack. 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 Im 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. DuemilanoveCellSensor. 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 4. X and Y axis, which is 1. I arbitrarily took 2. 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.