Monday, August 26, 2013

Google Drive Download Widget, a download button generator

Google Drive Download Button is an online app that builds a download button you can use in your website.
  1. Set the sharing settings for your file to "Public on the web" or "Anyone with the link"
  2. Copy the "sharing link" at the top of your Google Drive sharing window and paste it in the textbox, or copy the "fileId" in the textbox
  3. Click the "build button".
  4. Use the HTML code in your website
This small app makes use of the Google Drive API to check the file existance and get the file size.
If you would like to install this app you only have to generate a API key from the Google API Console, enable Drive API service, generate a Server or a Browser key and then paste your API key in the functions.js file.

That's it :)

You can find a running demo of this application here:
http://www.davidegironi.it/apps/gddb/


Code
Notes
  • read risk disclaimer
  • excuse my bad english

Monday, August 19, 2013

An optical dust meter that uses the GP2Y1010AU0F sensor library made with AVR Atmega

This project is a dust detector that use the GP2Y1010AU0F sensor.
Attached you can also find the GP2Y1010AU0F sensor library for AVR Atmega.



GP2Y1010AU0F is a dust sensor by optical sensing system. An infrared emitting diode (IRED) and an phototransistor are diagonally arranged into this device. It detects the reflected light of dust in air. Especially, it is effective to detect very fine particle like the cigarette smoke.


Unfortunately the datasheet does not tell anything about the particle size detected, it just tell us that this sensor is for fine particle like cigarette smoke, that is to say about 0.5micron.

This sensor output a pulse-driven wave form that we can read using the ADC of our microcontroller to convert it to usefull data.
Looking at the figure 2 of the GP2Y1010AU0F datasheet we can derive the method to convert the output data.
Note that the sample time should be 280us to perform the correct reading, and this delay should consider that ADC conversion takes 13 ADC clock cycles, so ADCtime(s) = (1/ADCclock)*13 = (1/FCPU/ADCprescaler)*13.
So to perform reading at correct time we have to subtract the time taken by ADC convertion to the suggested time.
As example lets consider a micro running at 8Mhz, with ADC prescaler set to 64
(1/(8000000/64))*13 = 0.000104s = 104us
280us - 104us = 176us
we have to delay 176us and then we can read the sensor output voltage.
Once we have obtained the sampling voltage, we can convert it to mg/m^3 using the fig 3 of the GP2Y1010AU0F datasheet, that shows the dust density (mg/m^3) related to output voltage of the sensor (V).
Chris Nafis does some interesting consideration on this sensor in his Air Quality Monitoring page. Also he does linear interpolation and find the graph obtained the slope and the base for the convertion function.




Code

Notes
  • read risk disclaimer
  • excuse my bad english

Thursday, August 1, 2013

AVR Atmega multiple 8x8 led matrix using MAX7219

This library implements a 8x8 led matrix for AVR Atmega.



It uses just one MAX7219 serial input/output common-cathode display drivers and 3 ports.
MAX7219 can refresh leds leving more resources to microcontroller.
This library uses MAX7219 without the need of SPI. User can setup scan limit and intensity setup.
Multiple led matrix can be attached.


With simple functions, it gives your the ability to:
  • power on / off a single led
  • setup a selected row
  • setup an 8x8 matrix
Setup parameters are stored in file ledmatrix7219d88.h


Code

Notes
  • read risk disclaimer
  • excuse my bad english