Pages: 1 ... 4 5 [6] 7   Go Down
Author Topic: Arduino with shift registers to control 70 devices.  (Read 4829 times)
0 Members and 1 Guest are viewing this topic.
nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As far as I can see the PCB looks good now, normally you'd do 2-3 boards to test but these are so small (and cheap) you may as well do them all.

Note that I've never done a board without at least one error  (although they have all been larger) so be prepared for something we didn't see.

Anyone else like to do a peer review?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry about the delay. I submitted the PCBs and received the final product.
Made a prototype, tested the Voltage portion of the PCB. At least the regulated voltage works.

Now I have to test the D and Clk outputs. I have a Haceduino 2009 Duemilanove board w/ Atmel ATmega 328P-PU

I also have 2x ULN2803A devices

I am just looking into the Arduino setup and will practice with some programs.

EDIT:- Graynomad had a basic routine listed some pages ago.

for (int i = 0; i < N_CAMERAS ; i++) {
   digitalWrite (dataPin, i < TRIGGER_PULSE_WIDTH ? 1 : 0); // puts 1 out for the first 10 pulses, then 0
   digitalWrite (clockPin, HIGH);
   digitalWrite (clockPin, LOW);
   delay (DELAY);
}

The reference for digitalWrite is here
http://www.arduino.cc/en/Reference/DigitalWrite

Perhaps
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);

??
And here the futaba cables come into use :- ? These are just the right size for the motherboard pins.





« Last Edit: May 05, 2011, 10:17:35 am by zcream » Logged

Movement & Sound - mishra.tv Film Productions

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried the circuit. It does seem to work.
The camera powers on, however the trigger does not work.

I checked the specs for the 4013 IC. It only seems to give out 2-3ma during the pulse.
http://www.google.com.au/url?sa=t&source=web&cd=2&ved=0CCsQFjAB&url=http%3A%2F%2Fwww.toshiba.com%2Ftaec%2Fcomponents2%2FDatasheet_Sync%2F%2F152%2F35.pdf&rct=j&q=tc4013bp&ei=5c_HTfHCEM_OrQeApNDLBA&usg=AFQjCNH3qVVHxVYajlC8I8rwa6TPu7uDpg&cad=rja

Any idea what kind of a basic amp I could use in order to bring this up to 40 ma ?
Logged

Movement & Sound - mishra.tv Film Productions

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

40mA seems like an awful lot, was that mentioned before? I thought we were dealing with a logic signal.

You can probably use a FET or transistor, what exactly does the camera need to trigger? (too many pages to trawl back through) The way it is now I think it gets a 12v logic signal, if the FF is not up to the job the trigger signal will not go all the way to 12v and quite possibly won't propagate to the next FF. Is that what's happening?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh no. The propagation is not the issue.

In my haste, I did not test this with a breadboard, especially since there were non-standard DIPs.

The 1-2 ma logic pulse is needed to trigger the chdk enabled camera. I just realized that the camera needs about 40-100ma (safer to assume 100ma) to trigger. It was a logic signal, but apparently needed on the power + and - pins of the USB connector.

I trawled through some threads, turns out I should be able to connect this to the source of a MOSFET, bias it with the 3.3V output from the regulator and get some current gain.
This will draw power away from the camera, but I can shoot with the LCD off and avoid a lot of the power requirement.

Now I am just hunting for the right MOSFET and any resistors or caps I may need to use with it.
Logged

Movement & Sound - mishra.tv Film Productions

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This gets stranger and stranger..

From http://chdk.wikia.com/wiki/USB_Remote_Cable
I get
(For reference, an IXUS 80 being triggered with a device drawing power from a bench PSU set to 4.62V drew a maximum of 0.4mA from the trigger circuit during triggering.)

The output will definitely supply 0.4ma.

Perhaps the problem is the voltage for triggering.
From http://chdk.wikia.com/wiki/CameraFeatures

>>
3.4V NOT OK, 3.5V to 5.0V OK
>>

I am currently using 3.3V
Logged

Movement & Sound - mishra.tv Film Productions

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am currently using 3.3V
Then it looks like it's not OK. I can't remember, is there any reason not to use 5v? Even if there is it would be a quick test to see if that's the problem.

______
Rob
 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I had a 3.3V power wall wart available - thats all.
I will try 5V. Problem is that anything over 5v will blow up the USB receptor, so I will have to try slightly less than 5V.

Will bring up my bench power unit in the morning and try it out.
Logged

Movement & Sound - mishra.tv Film Productions

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am now using 5V from a PSU. Still no go. I ordered a small oscilloscope to test the output.

This is the code I am using - I tried variations of pulse width in case that was the problem..
The camera works with a mechanical switch remote. Not with the signal from the circuit.

/*
  Bullet time
Create a pulse on Data - 100ms long
Cascade it with a Clock transition across different cameras.
 */
// No. of cameras in bullet time. This no. can also be greater than the number
#define N_CAMERAS 100
// 10ms delay for the camera. Thats a 100fps rate, and a 400% slowdown of the motion
// TRIGGER_PULSE_WIDTH is 100ms/DELAY(ms)
#define TRIGGER_PULSE_WIDTH 16000000 // 100ms trigger pulse will switch on the camera

// Delay between switching each camera, slightly less than 10ms
#define DELAY 9900
  // 6 = Clk ; 7 = D
#define CLOCKPIN 6
#define DATAPIN 7

void setup() {               
   Serial.begin(9600);      // open the serial port at 9600 bps:
  // initialize the digital pin as an output.

  pinMode(CLOCKPIN, OUTPUT);   
   pinMode(DATAPIN, OUTPUT);     
}

void loop() {
Serial.print ("No. of cameras "); 
Serial.print (N_CAMERAS);
Serial.print (" Trigger Width ms ");
Serial.print (TRIGGER_PULSE_WIDTH);
        Serial.println("");
for (int i = 0; i < N_CAMERAS ; i++) {
   digitalWrite (DATAPIN, i < TRIGGER_PULSE_WIDTH ? 1 : 0); // puts 1 out for the first 10 pulses, then 0
   digitalWrite (CLOCKPIN, HIGH);
   digitalWrite (CLOCKPIN, LOW);
   delayMicroseconds (DELAY);
}           
}
Logged

Movement & Sound - mishra.tv Film Productions

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll have a deco at the code, but you should be able to prove the hardware by just touching the camera's trigger wire to one of the FF outputs. No need for clocks, just touch to Q and if that doesn't work /Q.

Quote
The camera works with a mechanical switch remote.
This worried me, mechanical switches just connect the trigger input to something, the question is what's that something, 5V, GND, ??. Do you have a schematic for the remote switch.
_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Its working now for the first board. The camera turns on and takes a picture. I had my D and Clk swapped. I worked for higher values of pulse all the way upto PULSE** = 10.

I then connected the next board by connecting an ethernet cable. It can power on the camera - so the power transfers fine. However, there is no signal to switch on USB.

Just wondering if the D and Clk signals get transmitted fine.

EDIT:- Looking at the circuit, I just realized that D is passed as-is. So the first camera is basically getting a direct signal from the Arduino board.

Now I need to check if there is something on the Q output that works.

The mechanical remote is a switch connected to 3.3V, pressing the switch gives the pulse on the USB levels.
Here is the schematic
http://chdk.wikia.com/wiki/USB_Remote_Cable
« Last Edit: May 10, 2011, 09:08:31 am by zcream » Logged

Movement & Sound - mishra.tv Film Productions

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's one problem

#define TRIGGER_PULSE_WIDTH 16000000

Not sure what you get without the UL suffix but it's going to be a big number I think, then you do

digitalWrite (DATAPIN, i < TRIGGER_PULSE_WIDTH ? 1 : 0);

So until i gets to this "big number" you will always get a 1. Assuming the FFs are reset before you start (are they?) this will produce a traveling leading edge but no falling edge for "big number" * 9900uS.

Having said all that it may not make any difference as I would think the cameras trigger on the leading edge and you should still be getting that.

Also, having

Code:
Serial.print ("No. of cameras "); 
Serial.print (N_CAMERAS);
Serial.print (" Trigger Width ms ");
Serial.print (TRIGGER_PULSE_WIDTH);
Serial.println("");

Inside loop() will not only be very annoying but seriously affect the timing.

Also the numbers being printed won't display because they will not be printable ASCII.

Here's a modified version
Code:
/*
  Bullet time
Create a pulse on Data - 100ms long
Cascade it with a Clock transition across different cameras.
 */
// No. of cameras in bullet time. This no. can also be greater than the number
#define N_CAMERAS 100
// 10ms delay for the camera. Thats a 100fps rate, and a 400% slowdown of the motion
// TRIGGER_PULSE_WIDTH is 100ms/DELAY(ms)
#define TRIGGER_PULSE_WIDTH 10 // 100ms trigger pulse will switch on the camera

// Delay between switching each camera, slightly less than 10ms
#define DELAY 9900
  // 6 = Clk ; 7 = D
#define CLOCKPIN 6
#define DATAPIN 7

void setup() {               
   Serial.begin(9600);      // open the serial port at 9600 bps:
  // initialize the digital pin as an output.

pinMode(CLOCKPIN, OUTPUT);   
pinMode(DATAPIN, OUTPUT);   
Serial.print ("No. of cameras "); 
Serial.print (N_CAMERAS, DEC);
Serial.print (" Trigger Width ms ");
Serial.println (TRIGGER_PULSE_WIDTH, DEC);
}

void loop() {

for (int i = 0; i < N_CAMERAS ; i++) {
   digitalWrite (DATAPIN, i < TRIGGER_PULSE_WIDTH ? 1 : 0); // puts 1 out for the first 10 pulses, then 0
   digitalWrite (CLOCKPIN, HIGH);
   digitalWrite (CLOCKPIN, LOW);
   delayMicroseconds (DELAY);
}           
}

______
Rob


 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem seems to be the 16MHz frequency of the Arduino. The 4013 FF seems to work till 8MHz at 5V.

I have changed my pins to 5 and 6 as they support PWM. I am just reading up on PWM and will try to implement some code. I dont really need a frequency more than 100Hz as the trigger pulse is 100ms and the min delay is 10ms i.e. 100Hz

There seemed to be an option with AnalogWrite and another using the registers to set the frequency.
Logged

Movement & Sound - mishra.tv Film Productions

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The problem seems to be the 16MHz frequency of the Arduino. The 4013 FF seems to work till 8MHz at 5V.
I don't see the connection.

The pulse the FFs are receiving comes from this code

Code:
   digitalWrite (CLOCKPIN, HIGH);
   digitalWrite (CLOCKPIN, LOW);

which given the machinations the digitalWrite() func goes through should be slow enough. But just in case add a delay.

Code:
   digitalWrite (CLOCKPIN, HIGH);
           delay (1);  // 1mS pulse, subtract 1000 from the other delay to compensate
   digitalWrite (CLOCKPIN, LOW);

Note that when you have 70 FFs and metres of wire you will have to buffer the signals I would think.
______
Rob

Logged

Rob Gray aka the GRAYnomad www.robgray.com

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I know what the problem is,
I gave Vdd a voltage input after the 3.3V stabilizer.
That gives an output voltage of 3.2V, which may be too low after drops.

I am going to try to tie the voltage input directly to 5V. Would I need a current limiting resistor of some sort ?
Logged

Movement & Sound - mishra.tv Film Productions

Pages: 1 ... 4 5 [6] 7   Go Up
Jump to: