Monday, 22 February 2016

Wi-Fi controlled Air freshener

This is my project , a Wi-Fi controlled Air freshener.

Hi , I've found the best way to learn programming is to create a real project , so that you can solve problem you will encounter on the way ,which will allow your projects to get more and more complex as you learn.

The Hardwate

The hardware part Is made from a hacked automatic air freshener pump dispenser.
I could have easy built my own using a servo pressing down on the can`s top and built my own case, but why re-invent the wheel.

The Software

( 1 ) I started with a simple test code which would momentarily activate a port controlling the dispenser , go to sleep for 10 minutes to save batteries and whole restart the cycle again.
( 2 ) My next idea was to use the inbuilt ADCs on the photon to publish the voltage of the batteries , which turned out to be not so simple as first thought.
I build a voltage divider using 2 x 1k resistors and found that this method give inconsistent results also was not very battery friendly.
I decided to use a external ADC which give more consistent results and wasn't a big drain on battery life.
( 3 ) Now I wanted a method of controlling various variables used in my photon program , which would allow me to change the time in sleep ( The time between each pump of the  dispenser ) , the time the arm would press in the can , and the number of pumps, etc.
After a lot of trial and error I found a way to post the voltage to a cgi script and receive back a json data block.  
This was all right , but had to manually define each variable by editing the script by hand every time I wanted to make a change to the timing or number of pumps.
( 4 ) Next a made a user script using html form elements , so I could generate a json file to save , which the other script would load and control my photon.
This script has started to grow in complexity when new ideas form, which lead to having to rewriting all the other code.

Tuesday, 23 September 2014

Been taking quite a lot of pictures

Have been taking quite a lot of pictures over the last few weeks since I got my new dslr , almost to the point of wearing it out.
I started by visiting Rother valley ski centre and taking picture of the ski-ers , which I think are in fact wakeboarders.

My last big shot was finding that they was a bee on some flowers in my garden , so rushed upstairs to get my camera.    


Friday, 15 August 2014

go pro time lapse video

Didn`t think much about the idea of taking long time lapse videos after reading about shutter wear on dslr cameras, So moved over to my GoPro Black 3 which doesn`t have a shutter the wear out !!!! 
This was taken with 10 sec per shot & 1800 captured imaged before the rain started and didn`t what to get my go pro wet.

Friday, 8 August 2014

My first dslr

I`ve just purchased my first DSLR camera so I could regain one of my old time hobbies,  photography.
The last SLR I owned was a canon 35mm roll film camera , so this is my first real digital SLR and not a compact camera .
I spent a week looking at all the reviews and finished up purchasing a canon rebel 5i , which is called the canon 700d in the u.k .
From my tests so far I`ve had some good results from the camera , but I am very very limited with the shots I can take with the only lens I have now . which is the 18-55mm kit lens.
From the review the camera does hd 1080p video , but at this time that is not my interest.  

Saturday, 22 March 2014

My udoo is dead

My udoo is dead and going back to Rapid electronics.
That was very short lived !!!!!!

Wednesday, 19 March 2014

Why use MCP23008 / MCP23016 / MCP23017 expanders . Part 1 / 2

The first thing which I test for on any new embedded micro is a usable I2C bus aka TWI , two wire .

I2C comes into its own with the use of I/O Expanders, which can give you up to 128 extra I/O pins per bus and only need 3 or 4 wires from the controller.

An added advantage of this is that the controller is isolated from the expander, so with only a simple logic level converter on SDA and SCL rails , the voltage on the expander can be different to the controller , 5 volt logic on the expanders on a controller which is only 3.3 volt tolerant, plus if anything goes wrong you will most likely blow up a cheap easy to replace chip instead of a forever dead pin on your embedded micro.   

If my last part was why, then I guess this part should be named HOW.

Firstly I would like to hope that you know all the basics of I2C,  like needing pull up resistors and that if possible only one resistor should be fitted with a value of between 1k and 10k, I've found that normally a value of 2.2k or 4.7k works best for me.
You should check if pull up resistor are installed on the board by default which some are like the Arduino due , Raspberry pi and the udoo board , but all of my other platforms do not , Arduino mega , Arduino duemilanove , flyport , MBED Arc Pro.

WIRING the chip

The thing you should do when trying to interface any chip is to know the pin out by downloading any maker documentation.

The MCP2308 and MCP23017 are very easy to wire , where the MCP23016 is just a little bit more complex due to need of extra components.
The first thing which confused me on the diagram was the term VSS and VDD, which I found that VSS is what you normally call Ground / the negative supply and VDD the positive supply , at this case 3.3 or 5 volts. ( VCC normally ) 
Don`t forget if the chip is 5 volt powered and your controller is not 5 volt tolerant both the SDA and SCL need to pass through a logic level converter.
The other thing you need to know are the address and reset pins.
Firstly the reset pin, which should be connected to the positive supply , but the chip can be reset by a connecting to ground. 

Addressing and software I will tak about in the next part

Learning Fritzing so the next part with be delayed

Please feel free to leave me a comment, so I know I'm not alone.