TAMRON 70 – 300 LENS interface project

TAMRON 70 – 300 Lens test driver, by G8GKU.

This article presents information relating to the interfacing of a TAMRON lens to an Arduino Nano.

Having acquired a well-used TAMRON 70-300 mm A.F. zoom lens, ( Cannon mount ) from a photographer friend, along with the information that the lens now only occasionally operates properly after many years of faultless service, it was decided to attempt to communicate with the lens, as a technical challenge.

Important.  Before proceeding further it has to be made 100% clear that the information presented here relates to a written-off lens with zero financial value. Any use of this project and related information should only be undertaken with the full understanding that interfacing to a lens of financial value may result in financial loss and / or damage to the lens. Be warned.

General Information.  The lens is of the older technology where the auto focus mechanism is driven by a miniature electric motor.

A reader may be tempted to immediately connect the lens to the interface electronics and then to run the code, however,  it is strongly suggested the notes below are read first.

If a fast start is needed then as a very minimum read the paragraphs relating to the wiring to the lens and connect the lens to the electronics only via the recommended resistors as detailed below and ensure the correct voltages are available before running the code.

Information gleaned via the internet indicated the lens communicates with the host camera via a serial protocol, in this case a three wire SPI bus.

Lens electrical connections.  Physical electrical connections between the lens and camera are via contacts arranged in semi-circular layout on the camera-facing mounting ring of the lens.

The lens used has 7 physical connector pads, others may differ.

Details of the individual contacts were quickly found via the internet, a brief
list of the contact pads is below ;

Visually the external lens contacts are distinguished by having a double-width pad placed second from one end of the group, the adjacent single pad is taken as ‘first’ pad in this project.

Taking the first pad, ( as above ) the pads are believed to have functions as listed below ;

Vbat ( +5v ( 6v ? ) power to the lens motor-drive electronics )
Analogue Ground, ( note, this is the double width pad, ground 0v, relating to the motor power )
VDD ( believed to be + 5v )
Data Out ( from camera, into lens )
Data In ( into camera, from lens )
Data Clock ( supplied by camera )
Digital Ground ( ground 0v, for data connection(s) )

N.B. in this interface project the Arduino Nano will provide the signals relating to the ‘ camera ‘  in the list above.

 

Lens ( Motor ) powers supply, ( 5v )

Nominally the lens motor power is supplied to a dedicated lens connector and is separate from the Logic 5v Vcc.  The author supplies the 5v motor supply from a bench power supply set to 5v. It may be possible to use the same 5v as used for the Vcc from the Nano, additional capacitors on the 5v line would be suggested. However, the author has not tested this, only the bench supply being used.

To initially test the overall project, the code will read back the Zoom position without the motor power being supplied, as only the Vcc 5v is needed. This allows a ” gentle start ” to the experiment before the motor 5v is applied for tests requiring it.

 

Interface Wiring.  (  Interface wiring to the lens )
It must be noted that the easiest connection method which is also 100% non invasive to the lens itself, is to use a lens adapter or extender unit, which carries duplicated pins on both sides, fitting between the lens and the camera body.

If available, such an adapter could have the interface wires  fitted in an invasive fashion and as such may be used as a connection platform for the lens interface, thereby not making intrusive change to the lens.

As the above was not an available option and the lens in hand was a zero-cost write-off, the mounting ring and similar parts of the lens were unscrewed and removed, providing access to the inner electronic system parts of the lens. The fixing screws are small scale and are tightly fitted. Use of a clean and un-rounded
screwdriver is recommended, use a firm grip.

After dismantling it will be found that the pads on the outside of the lens are part of a small plastic mounting assembly, held in place by two further small screws, removal of these screws releases the pad assembly. To prevent any chance of the contact pads of the released contact assembly touching other electrical connections, the pad unit was covered with removable insulating tape.

The pad assembly is electrically connected to the internal curved printed circuit board ( PCB ) by means of a short flexible multi-track PCB.

**IMPORTANT**
If the conductors of the above short flexible PCB are inspected it will be seen that the first external pad and the double-size pad are swapped in sequence by the flexible PCB as it terminates to the inner PCB.

Image above shows thin wires soldered to inner curved PCB.

To make the physical wiring interface to the lens, seven thin flexible multi-strand wires were soldered to the inside destination end of the flexible PCB. Each wire being about 50 cm in length. The lens end of each wire being trimmed back to about 1 mm after solder tinning, facilitating small joints. Delicate and careful soldering is required, use a different colour for each wire if possible.

Allowing for the above two-pad reversal, the wires soldered to the inside curved PCB are as below in sequence, starting at the end where the double-width pad terminates to the inner PCB via the flexible PCB ;

Analogue Ground, ( note, this is the ( external ) double width pad, ground 0v, relating to the motor power )
Vbat ( +5v ( 6v ? ) power to the lens motor-drive electronics )
[ items below are in same sequence as per the external pads ] VDD ( believed to be + 5v )
Data Out ( from camera, to lens )
Data In ( into camera, from lens )
Data Clock ( supplied by camera, in our case, by the interface )
Digital Ground ( ground 0v, for data connection(s) )

Due to the operation of the electrical interface within the lens it is important that
resistors are used to allow the lens and the Arduino Nano to interlink and operate without problems which may be caused by code or other errors, also under normal operation.

Do **NOT** directly connect the Nano pins, via wires,  to the LENS electronics.

Please see and use the wiring diagram, as below,  dia 1.

A summary of the wiring diagram is provided below for convenience, resistors in the MOSI and MISO lines are strongly recommended.
The resistors are soldered to the Nano end of the interface wires and heat-shrink insulated.

……  connect Nano MOSI, pin D11, via a 470 Ohm resistor ( 390R to 1k suitable ) to the Dout lens pad.

……  connect Nano MISO, pin D12, via a 470 Ohm resistor ( 390R to 1k suitable ) to the Din lens pad.

Please understand, without resistors in series with pins D11 and D12, it is possible that damage may or will be inflicted upon the lens electronics or the Nano or both if errors occur.

…..  connect Nano D13, logic OUTPUT, Clock signal source, via a 1k resistor to the lens Data Clock input.

…..  connect Nano D8, logic INPUT, pin via a 2k2 resistor to the lens side of the Clock signal from D13

The two resistors for Nano pins D13 and D8 are mandatory.

Explanation.
When in operation, the CPU internal to the lens holds down the
clock signal whilst it is busy, typically post receiving a command.

Connecting the clock drive signal from the Nano to the lens via a resistor, will allow the Nano to drive the clock signal to the lens from Nano pin D13, without either Nano or lens suffering damage when or if the two ends are at opposite logic states, i.e. when the lens holds down the clock signal.

The 2k2 resistor allows the state of the *lens* clock signal( logic 1 or 0 ) to be read back into the Nano via pin D8.

The Code.
There is no intention in the code to provide anything close to a fully specified interface to the lens.
Code provided demonstrates how the interface protocol functions and provides an example which works in conjunction with the lens used by the author.

Functions provided will read the position of the zoom function and will drive the auto focus motor between close in and far out focus, also the Iris can be made to ‘ blink ‘.

Other functions and the related specific command codes are easily found via the internet and interested persons are invited to experiment with the code as they need.

 

code is found here ;

TAMRON

 

 

Perform Clean Install of Windows 10 on Dell Inspiron Gaming 7000 7577

Dell laptops are no where near as full of bloatware from the manufacturer as some others but they still do come with a lot of crap to get rid of. The cleanest and simplest thing to do if you buy one is to just format the machine and reinstall Windows 10.

The problem is there’s no install media provided.

First off, some things you should note:

  • Most models come with the M.2 SSD drive which requires drivers during windows install.
  • You won’t require your Windows 10 key from the old install. It is no longer on a label stuck to the machine unfortunately, it is stored in one of the chips on the motherboard. The installer will pick up the key automatically.

Steps

  1. Download and run the official Windows 10 tool https://www.microsoft.com/en-us/software-download/windows10 to create a bootable USB stick.
  2. The above tool will take some time but once it has finished you will need to download the Intel drivers for the SSD else you won’t be able to get that drive listed during the Windows 10 install. Get the SSD drivers named f6flpy-x64.zip (64-bit Operating System) here:  https://downloadcenter.intel.com/download/27147/Intel-Rapid-Storage-Technology-Intel-RST-?v=t
  3. Unzip the intel drivers into a directory on your USB memory stick.
  4. Restart the laptop and press the F12 key during boot to get to the boot menu.
  5. Select your USB stick to boot from and follow the instructions.
  6. When it comes to selecting a hard drive to install windows to make sure to click the CD icon and navigate to your driver directory on the USB stick and install the SSD drivers.
  7. Delete all the partitions on both HDD and SSD.
  8. Create a new partition on the SSD and go ahead and install windows as normal.
  9. Once Windows is installed you’ll also want to use disk management to setup the HDD and then you’ll be good to go.

Camera into a mine Adit.

You may be wondering just why this short article is to be found within the TripsInTech web page, images shown were the result of a trip to an old mine and there was an amount of tech, in the control of the camera system, hence it may possibly be justified!

There are many old mines scattered across the Welsh hills, many are blocked to entry of persons ( quite sensibly so ) or collapsed but some have limited access.

Unless with fully qualified cavers, do not ever enter a mine.

Permission of the landowner / agent was obtained before accessing the land.

One such mine, Nant Y Mwyn lead mine, at approximately 300 mtrs altitude  in the Carmarthenshire hills,  has a number of closed off entrances. However, there is one adit ( entrance ) which although blocked by many tons of rock does have a small gap in the rock filling, which was judged to be just big enough to allow entry of a suitable camera. The small entry is way too small and probably unsafe for a person to enter and therefore after a little creativity, a modified digital camera was mounted on a Pan and Tilt ( P.T.) motor drive assembly which in turn was mounted at the business end of an eight meter telescopic pole. The pole when collapsed into itself became a manageable 1.5 m set of aluminium tubes to make walking up to the entrance easier.

During the making of the P.T. assembly it was a realised there was a risk of total loss of the camera and P.T. mechanism when it is placed into the adit. Therefore, instead of utilizing a more up to date camera type as may be seen on adventurer’s helmets and many similar situations, it was decided that a fully working but no longer used Olympus digital camera  was to be used, along with a small and relatively cheap high-brightness infrared domestic property surveillance video camera.

To make the P.T. a number of standard ” R.C. ” servo’s were used, the type often found in model making, one being modified to give 360 degree rotation. The servos were mounted so as to rotate the camera head in 360 degs horizontally and to move through about 170 degs vertically, with a ” directly ahead ” view being about half way in the vertical movement. Servo control pulses were generated from a PIC18F8723 processor, being part of a Microchip development board, a few pages of C code being written for the purpose. User control and interface was by a laptop running a terminal programme and a video application to view the scene as imaged by the infrared video camera. Between the laptop and the camera P.T. head was a simple serial port cable for control signals and a video cable.  Control of the digital still camera was by means of a directly wired interface from the PIC board directly to the camera controls, essentially in parallel with the manual press button controls. Yes, of course, the Olympus digital still-camera could have been controlled via USB with a suitable application but that route was not followed.  Images copyright J.W.C. G8GKU.

General view into adit, mid height camera position. Rocks on floor are part of backfill blocking the entrance.

 

General view, with high camera position, detailing ” roof ” near entrance. Note a lack of visible shot-holes, was this adit hand cut ?

Close image of right hand side wall and partial rock fill.

 

Remember to keep well clear of mine tunnels and unless with fully qualified explorers do not ever enter a mine.

XML to JSON python script (Also JSON to XML)

Here are 2 python scripts which convert XML to JSON and JSON to XML.

XML to JSON

Create the sample XML file, with the below contents.

sample.xml
<planets>
	<planet>
		<name>
			Earth
		</name>
		<radius>
			6,371km
		</radius>
	</planet>
	<planet>
		<name>
			Jupiter
		</name>
		<radius>
			69,911km
		</radius>
	</planet>
	<planet>
		<name>
			Mars
		</name>
		<radius>
			3,390km
		</radius>
	</planet>
</planets>

Run the below python script and and it will output the converted XML as a file named output.json.

import json
import xmltodict

with open("sample.xml", 'r') as f:
	xmlString = f.read()

print("XML input (sample.xml):")
print(xmlString)
	
jsonString = json.dumps(xmltodict.parse(xmlString), indent=4)

print("\nJSON output(output.json):")
print(jsonString)

with open("output.json", 'w') as f:
	f.write(jsonString)

JSON to XML

Create the sample JSON file, with the below contents.

sample.json
{
    "planets": {
        "planet": [
            {
                "name": "Earth",
                "radius": "6,371km"
            },
            {
                "name": "Jupiter",
                "radius": "69,911km"
            },
            {
                "name": "Mars",
                "radius": "3,390km"
            }
        ]
    }
}

Run the below python script and and it will output the converted JSON as a file named output.xml.

import json
import xmltodict

with open('sample.json', 'r') as f:
	jsonString = f.read()

print('JSON input (sample.json):')
print(jsonString)

xmlString = xmltodict.unparse(json.loads(jsonString), pretty=True)

print('\nXML output(output.xml):')
print(xmlString)

with open('output.xml', 'w') as f:
	f.write(xmlString)

You may need to install the xmltodict module:

pip install xmltodict

Minecraft won’t launch with error code 5

If you launch Minecraft and get an error as above, along the lines of cannot copy file error code 5 then you can potentially fix this by renaming a file as below.

 

Rename

C:\Program Files (x86)\Minecraft\tmpLauncher.tmp

to

C:\Program Files (x86)\Minecraft\minecraft.exe

Then just run the minecraft.exe file and it should start to download the runtime and then start up. Worked for me 🙂

Satellite image pager interference

Although many satellite images are captured with little or tolerable degradation, due to the effects of near band or in band pager interference, some images are more badly affected. This image received from Meteor M2, June 20 2017, orbit number 15301, 11:00 hours, 137.900 MHz, shows the effect of both in band and near band data transmissions from local, ( Oxford, UK )  high power pager style systems.

Meteor M2 UK, Europe, June 20. Orbit 15301