Translate

Thursday, 25 May 2017

Sony Xperia Z5 Compact Camera replacement.

I've had my little Sony phone for a while now, and it has been superb....

... until the other day when the camera started to play up....


Hmmmm, not ideal.

If you put some pressure on the phone, around where the camera lens is, it would come back to life for a few seconds, sometimes with some bizarre effects...

.. not ideal at all....

I thought I could live without it, but after a week or so, I realised how much I used it for taking quick pictures of wiring etc ... I decided
I'd need to investigate, so I googled disassembly instructions, but couldn't find a video or instructions that had the same layout as my phone.

I removed the back of the phone and quickly diagnosed that the camera module itself was at fault (I was hoping some connector had just come lose, no such luck).

A new camera module was sourced from eBay for a princely some of £13.95 delivered... I ordered a replacement adhesive gasket kit as well (£2.45)




So here's how it's done...

Switch the phone off, and gently heat up the back of the phone with the wife's hairdryer or a heat gun set to low.











Get a sucker and a prying tool and gently remove the back. If it doesn't come away easily, heat it up a bit more. Don't risk bending the metal back....









Right, that's good.














Un-latch the NFC aerial connector at the end shown ....











... and lift it out of the way.














Unscrew the small pozi screws retaining the aerial module .....























... remove it, and place it to one side.













Undo all the screws on the plastic frame .....











... gently work a small insulated tool (this is a ceramic screwdriver) under the flash LED (it's retained with a small blob of adhesive) ...










... and hinge it out of the way.













Carefully prize the plastic frame out. The flash LED should slide through the frame.










Excellent.













Just for piece of mind, disconnect the battery.













Now prize up the camera connector....












... and remove the camera.











Worryingly, the new camera didn't come in ESD safe packaging....












... and was supplied with some sort of rubber gasket, which the original camera didn't have, I just slipped it off...










Some careful bending of the camera's ribbon cable, and it all fits in, and the connector is pushed home.

Now put the phone back together again. When fitting the frame make sure the flash pokes back through, and the NFC connector doesn't get trapped.

Replace the adhesive gasket, and replace the back...


... and go and take some photo's !













Got my thumb in as usual .... ;)



Friday, 19 May 2017

Return of the Arduino Dehumidifier controller.

My very good friend Oto has a problem.

He's moved into a new house.

He's wanted some space for his lathes & mills etc, which this has.

 After a few weeks, his machines are showing signs of going rusty.... Why is this?

 It's humidity.. after installing a dehumidifier, things have improved dramatically, except his electricity bill...

 It's time for a slightly revised version of the first project I did on this website back in May 2014 (where does the time go??!?)

It's got a similar display, except it's in Czech, but it has an adjustable set point for humidity, and a mode switch to set between auto , whereby it switches on 5 degrees C before the dew point, or manual, where it switches on when the desired humidity set point is reached.

The mode switch is S2 on the diagram below, and S3 is a centre-biassed momentary toggle, which is used to alter the set point up or down.

The set point is stored in E2PROM, and is restored in the event of power failure.


The temperature and humidity is read from a DHT22 sensor, and the dew point calculated.

The dehumidifier is switched on with a suitable rated relay, via T1.

Here's the code:








... hope Google's translate has done a reasonable job!

Saturday, 13 May 2017

BSR UA14 "Monarch" Record player repairs and upgrades!!

I had one of these in a record player as a child. It was my father's from when he was young ...

... then my good friend Colin posted one up for sale on facebook.


Nostalgia flooded in and a deal was done....

The one I had as a child was a sort of blue/grey colour...

It's a 4 speed autochanger, made around 1962. At some stage in it's life, the original "flip over" cartidge (to select a stylus suitable for LP (45's and LPs's) and 78) had obviously failed (it was most likely a crystal cartridge), and someone had replaced it with a ceramic cartridge.. all mono of course..

Mechanically it was all complete, and the usual solidified grease problems were very minimal.

Now a ceramic cartridge is a nasty thing. Even the best track heavily, and will chew through records, not good.

Checking the tracking weight with the tracking weight spring on minimum (there's no counterweight here!) gives encouraging results...

(excuse the thumb)








This deck was never designed to track with modern light tracking carts of a few grammes, so a suitable stereo cart would need to be found.... digging around in the box of record player spares turned up a nice Shure SC35C broadcast cartridge, moving magnet, designed to track between 4 and 5g and a nice spherical stylus, so alignment shouldn't be too fussy... perfect... except it has the standard mounting using two holes... the arm on the BSR has one central hole... an adaptor plate would need to be fabricated. Even tracking at 4-5 grammes, the Shure won't damage my precious records because it has a very large diamond.


Thankfully, back in the 60's, the lovely people at BSR had thoughtfully wired the arm for stereo.

Now the cartridge doesn't look central in the arm, does it? I carefully made the adaptor plate, and it's spot on. I checked the alignment to the pivot, and it is spot on!







A quick tweak to the alignment with a "Stupid protractor" and check the weight...

Spot on the optimum weight! It's a pure fluke! One spring hole either way and it's 2g or 6 !!!








Lash the output into an amplifier, out with the K-Tel Rock Classics workshop test record....


Surprise of all surprises, it doesn't sound half bad! .... Then the rest of the afternoon was wasted playing records....




Now I'd better do something with the cardboard box plinth, and make something proper up!

Sunday, 23 April 2017

AVTECH / Reptile H264 CCTV box fault and repair.

I bought this CCTV box, and some cheap cameras a few years ago, after I had a motorcycle stolen (talk about closing the stable door etc etc).


Other than a hard disc replacement a good few years ago, it's been very reliable...

.. until recently, when it's been acting up a bit.

It's been losing it's network settings, preventing me checking up on things while I'm out via my mobile phone and the "Eagle Eyes" app. 

Get home, reset them and it's OK again for a day or so.

Everytime, it resets the network IP address to seemingly random 10.xxx.xxx.xxx address, which isn't compatible with my home network, which is the usual 192.168.xxx.xxx ... It also sets the port number to a random number too ...

Off with the lid ....

Not much inside, a small board, the HDD and a small power supply converter...











.... and a very guilty looking CR2032 lithium cell, which proved to be only reading 1.4V instead of 3v ....








Replacing this and resetting the settings on the box has sorted it :)

Saturday, 25 March 2017

Arduino LiPo charger / monitor.

I've been using 18650 LiPo cells for a while in a few gadgets.

I'd purchased a small charger module from eBay, and assembled a single cell charger.




It worked well, but it just wasn't geeky enough ... I'd like a bargraph, voltage and percentage on a nice colour screen, and the ability to charge 4 cells...




so, I bought some more charger modules from eBay....













... a high current (5A) adjustable buck converter ...











...  a super cheap 2.2" ILI9340C display ...










... and a 4 cell battery holder ...












... some tea was drunk, and a plan hatched.

Each charger module will be connected to the high-current 5V supply, and operate independently of the arduino. The battery voltage will be measured by the arduino, and will be used to produce the data for the display. When the charge complete LED on the charge module illuminates, the arduino will indicate this on the display.

Some code was created and a prototype lashed up...

First problem was the display. The ILI9340C is designed to operate on 3.3V. Mine was fitted with a 3.3V regulator. "Great" ... except the data lines need to be converted to 3.3V ...

I fabricated a small resistive divider board, and fitted it. Each line from the micro feeds a 4.7K resistor in series with a 9.1K resistor to ground. The display connects to the junction between the resistors. The 5v supply I left supplying the display, and the LED backlight was connected to 5V via 180 ohms... bingo!

Next was to modify the charger module, so we can see when then charging LED is lit. Now I looked at (what I thought was) the datasheet for the IC, and carefully soldered a wire to pin 8 of the IC, being CHRG (active low) ... great ... nope. It didn't work. It stayed happily at 5V, regardless of the state of the battery. Thankfully, after some googling, I found the correct datasheet, and reverse engineered the charger module...


I set up the buck converter to output 5.0V , and mounted it, the arduino and the charger modules on a piece of perfboard. Before connecting the charger modules, I calibrated each analogue input on the arduino to give an accurate voltage reading at 4.2 and 2.8 volts.

Connecting in the chargers, and putting a battery in gave me good results .... nice bar graph reading, pretty looking display, BUT putting another battery on charge revealed an issue.... the voltage reading was getting less accurate the more cells were on charge .... the meter actually over-reading the voltage. I messed about for a while with the code, seeing if there was a reading error (there always is a "settling time" with the arduino's analogRead function) .. but the fault wasn't there..

Measuring the output of the buck converter exposed the problem. Under load, the regulation was letting me down, the voltage falling to 4.76V. Now that doesn't effect the charger circuit, as it's designed to operate down to 4.5V... BUT it does effect the arduino's ability to make accurate measurements.. It's down to how the arduino's reference voltage is derived. The arduino's A to D uses a reference voltage, connected to the AREF pin (pin 21 on a ATMEGA328P). In arduino, this is coupled straight to the 5V supply... if the supply is moving about, so will the values from the A to D converter. Not good. Now we could put a voltage reference IC here, but I'm using a pro-mini, and modifying that tiny PCB is not an option.

A note on voltage calibration. When you first run the software, you may (probably will) need to alter the voltageCal value in the software to give accurate readings. Easiest way to do this is read the voltage at the battery compartment terminals of one unit with a meter, and compare it with the reading on the display. If the two don't marry up (it should be around 4.06V), then take the actual reading on your meter and divide it by the reading on the display. Now multiply that value by the current voltageCal and use this figure to be the new value for voltageCal. If the display is reading low, your multiplier will be greater than 1. If it's high, it will be less than 1.

Improve the power supply's regulation? OK, an option, but we're dealing with quite a high current output here , so perhaps that's not a good idea either...

Option 3, provide the Arduino with a separate regulated 5V supply. The load isn't much, and doesn't vary much either... Ideal. So, a simple 7805 and a handful of decoupling ? ... Almost ...


This is a picture of the reverse side of the power supply... the ground pin is at the bottom. See that resistor? It's 0.05 ohms. It's in series with our ground output. It's so the unit can calculate how much current is being drawn, and limit the current if required (there's a current limit pot on the top of the unit).

Whilst the module is not isolating (the output is still referenced to the input), the ground at the output of the module is not quite the same voltage as the ground at the input, and the situation gets worse as the current being drawn increases. So we need to feed our 7805 with the "raw" supply coming in, but ensure our ground (or more technically, reference pin) of our 7805 is connected to the ground on the output side of the module. Sorted.

It doesn't look nice.. it's a bit of a rat's nest..


.. except the display, which I'm rather pleased with ....










So here's the schematic...



... and the code...


... and a picture of the completed unit in use :)



One word of warning... put the batteries in the right way round. Reverse polarity will destroy the charger modules, and possibly the A to D on the ATMEGA328 too :( .. don't ask me how I know...
I've now added 4 x 1A fast acting fuses in line with each battery.



Saturday, 25 February 2017

Arduino "analog" (analogue!!) clock.

I conceived this daft project a while back, after being given a box of surplus moving coil meters...

An Arduino driving three analogue meter movements to show hours, minutes and seconds.

There are lots of designs on the net, so here's another.

Now, I'd seen several clock designs on the net, whereby the Arduino's PWM signal is used to keep accurate time. I must say, whilst the idea is sound, most of the stuff I got hold of and downloaded didn't work for one reason or another.

The idea goes like this...

We couple the PWM output of a pin to an interrupt. We set the PWM output going with a mark to space ratio of 50%. The PWM frequency is governed by the internal architecture of the ATMEGA328, and is derived by some programmable timers, which divide down the clock frequency of the micro. The clock frequency on "posh" arduino boards is generated by a nice crystal (on not-so-posh boards, it may be a ceramic resonator, not so accurate). 16MHz. So dividing down this 16MHz should give quite a low error. Good news. So all we need to do is set up an interrupt, so that every time it sees a rising edge of our PWM signal, it increments a counter.

I measured the frequency of the PWM signal, and on a crystal clocked board, with a ATMEGA328P at 16MHz, it's 490.36Hz. (Due's/ Mega's etc will vary as the micro/clock frequency is different).


Excellent, so all we need to do is add a second on every time our counter hits 490 (Let's forget about the 0.36, shall we?). It should keep reasonable time.


After running for a day or so, the drift (caused by the 0.36 Hz left over) does become noticeable, but I recon it's no worse than a DS1307 RTC. So, to correct for this drift, I'll add in a 433MHz radio receiver module, and make it updatable from the GPS Master Clock project. Excellent.

So after a bit of tinkering this was born...


I've added three momentary push buttons, which allows the time to be set manually, and a "Cal" button. Once cal is pressed, the PWM output is switched off for 10 seconds, and then set to 100% for 10 seconds. This allows the user to set the zero mechanically on the meters, and the FSD (Full scale deflection) on the meter using the three pots, R7,R9 and R11. All three of my meters require 1mA for FSD, yours may vary, and you can alter the value of R7, R9 and R11 to suit your meters.

Each meter is driven by a small transistor. With my meters needing just 1mA, there's absolutely no reason why I couldn't just eliminate the transistor and drive the meters directly from the output of the micro to ground. I've added them in, just in case I need some more current, or decide to drive them from a higher voltage source than 5V. 

There's two toggle switches too... 

The 24 hour select switch changes the hour display from 0-24 hours to 0-12 (actually 12:00 or 0:00 is 0 on the meter, but it'll make sense in a minute)

The smooth select switch I'm rather pleased with. I started out wanting the seconds meter to move smoothly, rather that "tick" once a second. I coded this, and then thought I'd apply the same to the hours and minutes. This has one very pleasing effect. All the meters are moving smoothly. so the hour meter will read halfway between 1 and 2 when it's 1:30 ... same with the minutes. It also means that FSD on the hours meter occurs at 23:59 (in 24h mode or 11:59 in 12h mode), rather than going straight from 23 to 0 ..... 

Now, one big issue is daylight saving time. My master clock transmits GMT. I've added a routine that detects BST (British Summer Time) and adds an hour on if required. I've blatantly stolen this routine from here, , and modified it because I'm avoiding the time.h library (although I've no reason too!).

So a prototype is created....

Some meters selected, and calibrated ...












... and a clock created!...



Here's the code ...