Comments (24)
I have it working on the bench, using a real 24C02B EEPROM at address 0x51.
EEPROMs larger than 16Kbit cannot be used, because they use 2 byte addressing.
When the camera starts up, the first transaction on the i2c bus my logic analyzer sees is this:
The camera reads the first byte from device 0x51, which returns the value 3.
Note that you don't get any visible reaction from the camera at this stage. It's not until you actually start to send it commands that it does something.
Then it enters a loop, continually reading from device 0x48, which is a temperature sensor inside the camera:
The sensor responds with the temperature value encoded in 12 bits.
The terminal program on my PC has macro key functionality, which enables me to send the required binary strings to the camera.
E.g. to switch to stills mode, I send these four binary bytes (here in decimal); 234, 2, 1, 3
which is 0xea 0x02 0x01 0x03 when expressed in hexadecimal.
It looks like a rat's nest, but it works... π
Cheers,
Ragnar
from z-camera-doc.
Sure:
#include <Wire.h>
void setup() {
Serial.begin (9600);
Wire.begin(0x51);
Wire.onRequest(requestEvent);
}
void loop() {
// :DD
}
void requestEvent() {
Wire.write(0x03);
Serial.println (" envΓo un 0x3");
}
from z-camera-doc.
I totally forgot this post that I opened. I have it also working.
In my case I couldnt make it works with eeprom but I used an small arduino instead. And to be honest I do not respond to the temperature query :)
To test it I just used a simple vb .net program to test some functions and more or less was working.
Also, I upgraded the cam to the WEB latest on using the manual process (just drop the image on the root folder)
Good luck!
from z-camera-doc.
Not sure if I understand your question. If you ask regarding the connections:
CAM side Arduino side
GND GND
SDA SDA
SCL SCL
If you want, you can also power up the arduino with the cam (CAM VCOM to Arduino Vin)
from z-camera-doc.
Yes, it is possible to focus "manually" with UART commands. I put "manually" in quotes, because the camera must be in AF mode for it to work. EDIT: Later experiments show that the camera does react to focus commands when in MF mode.
I've been experimenting with some of the commands in "Z-Camera-Doc/expansion/expansion.md" and so far I've been able to
- Switch back and forth between MF and AF.
- Switch back and forth between Movie and Stills mode.
- Take stills pictures.
- Record movies.
- Query the camera for the lens focus position.
- Set the lens focus position.
- Control the focus speed (how fast the lens changes to a new focus position)
In the screenshots from my logic analyzer below, Async 0 is the camera's RX line, i.e. commands from my computer to the camera. Async 1 is the camera's TX line, responses from the camera to my computer.
If I send this, which is the GET CAMERA_CONFIG_LENS_FOCUS_POSITION command,
the camera responds with
The four bytes highlighted in yellow hold the current lens position. In the pic above it's focused at infinity. When focused at its near limit, the camera's response on the query is
Note the change in the yellow framed bytes. I have only tested with one lens (Olympus 25mm/1.8) so far, but I suspect the position values for close focus and infinity might be different for other lenses.
Finally, by sending SET CAMERA_CONFIG_LENS_FOCUS_POSITION commands, it is possible to position the focus point anywhere between the end points.
Command to set focus to near limit - focus position in the four bytes framed in yellow:
Command to set focus to infinity:
Command to set focus somewhere in-between:
I'm still very much in exploratory mode. I feel that the documentation on the UART commands is somewhat lacking in details... π
So, I've been doing a lot of trying out things, testing and experimenting. But at least I now know the key press sequence to reset the camera to factory defaults by heart π
I'll be away for a while, but I'll try to do a little write-up and maybe some code example when I get back.
Cheers, Ragnar
from z-camera-doc.
0x51 is 0xA3 shifted 1 bit right. it is the same 7-bit adress.
1 or 0 in LSB means Read or Write while accessing eeprom
p.s. my camera do not have any activity on i2c overall, always logic 1 on SDA/SCL
from z-camera-doc.
@RagnarJensen , that wonderful ! Is there any way we can talk about all of this, and if possible if you can help me make it work my side, off course if you need something in compensation (wink, wink) I'm okay with that's.
from z-camera-doc.
@garciaanto could you show the sketch?
from z-camera-doc.
@garciaanto do you have a wiring Shem for the Arduino ?
from z-camera-doc.
@garciaanto, that's it. On your sketch, where do I need to put my code ? For example if I whant to focus forward or backwards ?
from z-camera-doc.
Is it even possible to do this ? Because that really one thing that I need, be able to manually focus thought the I/O port...
from z-camera-doc.
@garciaanto did you find a way to manually focus with it ? Don't seem to find the code to use...
from z-camera-doc.
@CGFlyer85 wait wait...
My code the only thing that do is to enable the cam in uart mode. I mean, the little sketch that I wrote its only to let the cam boot on UART mode.
Once the cam is in UART mode, you can send commands to TX RX. You can find all availables command in " Z-Camera-Doc/expansion/expansion.md"
You can do that with arduino, or with vb .net or any other app.
from z-camera-doc.
@garciaanto would you mind posting some simple example Arduino code using the commands from the Github "Z-Camera-Doc/expansion/expansion.md"? For example, changing from the default video mode to stills mode?
If I can connect to the Z-CAM via I2C without having to use an EEPROM, that would be amazing!
from z-camera-doc.
@RagnarJensen You have made some excellent progress in the area of manually focussing the camera via UART commands. Would you mind posting your order of commands from camera startup to manual focus at infinite? Even better (and perhaps more convenient for you), some code would be excellent for this procedure.
My plan was to do something like the following:
- Use CAMERA_CONFIG_FOCUS_METHOD (Command No. 22, Hex 0x16) to change the focus from Automatic Focus to Manual Focus
- Use CAMERA_CONFIG_MF_DRIVE (Command No. 33, Hex 0x21) to "set MF drive". I'm not sure what "set MF drive" actually means ("Set MF drive" is used as an example in the Github expansion.md file).
- Use CAMERA_CONFIG_LENS_FOCUS_POSITION (Command No. 52, Hex 0x34) to change the focus to infinite. I was hopping that infinite focus would be as simple as 0xFF, but from your post above, it seems like that is not the case.
from z-camera-doc.
@RagnarJensen I noticed that in your focus commands, the third byte is 0x07, whereas the UART documentation says the third byte in UART SET CONFIG commands should be 0x04. Is there any reason for you changing it to 0x07?
from z-camera-doc.
@MechtEngineer The third byte is the length of the command or the response. E.g. in the GET CAMERA_CONFIG_LENS_FOCUS_POSITION command it is 0x02 and in its response it is 0x13.
I have no idea what the set MF drive command is supposed to do. I've only looked at it briefly, but I think I saw the focus position in the responses. And in their example, the length byte of it seems to be wrong.
from z-camera-doc.
I have actually never written code for an Arduino before... π³ This is my very first attempt ever, so go easy on me...
I have a couple of Teensy 2.0s left over from another project. I didn't write any code for them, other people did. I just integrated stuff.
The Teensy is a very close relative to the Arduino, it uses the ordinary Arduino IDE for coding stuff. So, I thought "how hard can it be?" Yes, famous last words, I know π It turned out not being too hard after all. I have managed to slap together a proof-of-concept sketch that actually does some things OK.
From the comments in the code:
"What this sketch can do:
- Simulate an i2c EEPROM, to make the camera configure itself for UART mode.
- At start-up, it waits for the camera to come alive.
- At start-up, it sets the camera to Stills mode.
- At start-up, it sets focus mode to AF.
- At start-up, it focuses the lens to infinity.
- Press button 0 to toggle between MF and AF.
- Press button 1 to slew focus between infinity and closest focus. Press again to go in the other direction.
- Press button 2 to focus farther away, in a step-wise fashion. There are five steps.
- Press button 3 to focus closer, in the same steps as above.
- Press button 7 to take a picture.
- Blinks the on-board LED in different patterns, to show status."
The code so far is of the "ugly hack" variety. It's definitely not pretty, but it may serve as an example for how to do UART communications with an Arduino.
I have set up a repository where I will publish the results of my experiments. You can find the sketch there.
RagnarJensen/Z-CAM-E1-IO
Bitscope oscilloscope/logic analyzer, breadboard, camera, batteries as focus targets and a CVBS monitor.
The grey, furry things on the camera are Rycote Micro Windjammers.
--
Ragnar
from z-camera-doc.
I've been messing around with my Arduino code and have now pushed a new sketch to my repo. It can do everything the earlier one did, but I've added analog input.
From the comments in the code:
"What this sketch can do:
- Take analog input (e.g. from a potentiometer) and focus the lens based on the analog value."
When I move the slider, the lens focus follows. It actually works pretty well π
The code is still ugly as sin. I'll clean it up later. Maybe... π
Cheers, Ragnar
from z-camera-doc.
@RagnarJensen Wow! This is absolutely magnificent! Thanks for all of your effort in posting your code and circuit. Outstanding stuff. I salute you!
from z-camera-doc.
Using flash with the E1. That's the reason I got interested in the I/O port, the API and UART control in the first place.
I've been mucking about with my Arduino code and I've added a resistor and a transistor to the breadboard. I can now trigger a flash from the controller. There are limitations, though. The electronic shutter's slow read-out speed and delays of varying duration in the camera make for some interesting challenges.
Head over to my repo for more info.
This is my very first successful picture taken with the Z CAM E1, using electronic flash as illumination.
@Chenel000 Thanks for the postcard π
from z-camera-doc.
Nice you like it @ @RagnarJensen
from z-camera-doc.
Currently I am working on building my drone where I expect to fly the Z E1 cam and use the connectors you send me, and really I miss to have time now to work on the programming side to configure and manage the camera. I expect soon to be able to join the team to work on this but first I need to finish with the flying platform.
My congratulations for job you are doing.
from z-camera-doc.
Hi,
I found these resources on Z cam E1 looking in internet for help.
I am interested in this camera for setting up a group of 4 cams to take pictures at the same time and then to stitch in pano pictures.
I will use manual fisheye lenses, no need to focus. Before buying I would need to to know if this cam may comply some requisites.
- I have a sony camera and for this purpose I use the function "enable picture without lens": is it possible to do the same with Zcam E1?
- Is it possible to set "aperture priority" and set a maximum limit in exposure time (e.g. not more than 1/1000s)?
- I would like to connect all the cams (via usb or other ports, connecting cables) to take a picture simultaneously. Is there a port for wired shutter release?
Thank you in advance for any hints and help.
Giuseppe
from z-camera-doc.
Related Issues (20)
- E2 RS232 HOT 3
- Questions about Z CAM E2G camera multi-device synchronization function? HOT 1
- GET ?act=info response returns incorrect values HOT 1
- adding E2-M4 Specs HOT 1
- HTTP control of pre-roll? HOT 1
- Streaming documentation for S1/S1 Pro
- Is Pelco-D on CTRL is RS232? HOT 4
- SDKζ―ζSUSEζδ½η³»η»ε
- Is libssp.so support suse os ?
- RTMP and SRT not working
- Lanc absolute focus
- S1 supported? HOT 1
- lens_focus_spd not working
- USB RNDIS connect to ipad
- command consistency HOT 1
- get lens_focus_pos key value HOT 7
- Can't find any doc around E2 UART protocol "async msg"
- Peak control
- Inconsistent lens focus position
- RTSP Stream artifacts - v1.0.3 E2-F6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from z-camera-doc.