-
Notifications
You must be signed in to change notification settings - Fork 22
/
MANUAL.txt
1358 lines (1087 loc) · 61 KB
/
MANUAL.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: Cyclops LED/Laser Diode Driver User Manual
author:
- Jonathan P. Newman (github [jonnew](http://www.mit.edu/~jpnewman/))
date: \today{}
geometry: margin=2cm
header-includes:
- \usepackage{setspace}
- \usepackage{placeins}
- \usepackage[multiple]{footmisc}
colorlinks: true
toc: true
toc-depth: 2
secnumdepth: 2
colwidth: 1000
reference-section-title: true
---
\newpage
![](./resources/cyclops_cartoon.png) \
**Cyclops** is a high-power LED/laser diode driver that enables precise control
of light power. The circuit was developed by Jon Newman while in Steve Potter's
lab at Georgia Tech in order to complete his thesis work, which required the
delivery of ultra-precise, continuously time-varying light waveforms for
optogenetic stimulation \[1,2\]. This was, and still is, not possible with
commercial hardware for optogenetic stimulation. Since its first use, the
circuit has been improved in terms of speed, precision, programmability, and
ease of use. This document provides construction, usage, and performance
documentation for the Cyclops LED driver. This document evolves with the
repository. To view old revisions, checkout tags or old commits using their SHA.
\FloatBarrier
\newpage
# Note From the Maintainer
I am very happy that this device may enable your scientific endeavors and I'm
sincerely grateful for your interest in the project. In general, I hope this
project will eventually be one small module in a of growing set of
__high-quality__, __open-source__, and __afforable__ tools that facilitate your
research and enable an __open__, __community-oriented__ approach to science.
Profits from the sale of Cyclops devices from the [official
store](http://www.open-ephys.org/store/cyclops-led-driver) go to funding the
Open Ephys non-profit organization. Since I receive no monetary compensation
from the sale of these devices, it would mean a great deal to me if you would
consider referencing the following paper (for which the Cyclops was developed)
in published work that makes use of the device.
> J.P. Newman, et. al. Optogenetic feedback control of neural activity. _eLife_
> (4:e07192) 2015. doi: 10.7554/eLife.07192
> [[link]](http://elifesciences.org/content/4/e07192v1)
For instance, in your methods section:
> Optical stimuli were delivered using the open-source Cyclops LED driver
> (Newman et al., 2015; www.github.com/jonnew/Cyclops).
Pull requests and issue submissions are __welcome__ on the github repo and
open ephys forum. If you have criticisms, fixes, suggestions for improvement
in the docs etc, please let us know so we can implement them ASAP.
Happy stimulating.
Jon Newman MWL@MIT
\newpage
# License
## Hardware Licensing
Copyright Jonathan P. Newman.
This work is licensed under CC BY-NC-SA 4.0. To view a copy of this license,
visit https://creativecommons.org/licenses/by-nc-sa/4.0
__Note__: This license applies to hardware designs and documentation which reside
in the 'device', 'experimental', 'resources' folders of this repository along
with information in 'MANUAL.md' and 'MANUAL.pdf'
## Software Licensing
Copyright (c) Jonathan P. Newman. All right reserved.
The code associated with the Cyclops project is free software: you can
redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
The code associated with the Cyclops project is distributed in the hope that it
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with
this code. If not, see <http://www.gnu.org/licenses/>.
__Note__: This license applies to software/fireware source code which resides in in
the 'lib' folder of this repository
\newpage
# Features
## Circuit Features
- Ultra-precise
- High power
- Up to 1.5A per LED
- Wide bandwidth
- \~2.5 MHz -3 dB bandwidth
- Maximum 100 ns 1.0A rise and fall times
- Current and optical feedback modes
- Built-in waveform generation
- Over-current protection
- Modular
- Arduino compatible: internal waveform generation
- Also, accepts external analog, gate, or trigger inputs
## Multiple stimulus generation options
- External stimulus sequencer
- External digital trigger
- TTL logic level
- External analog waveform generator
- 0-5V analog signals
- Internal 12-bit DAC
- Synchronized across up to 4 drivers
- Arduino library
- Programmable triggering logic
- Respond to USB input
\newpage
# Performance Specifications
## Dynamic Characteristics
The following oscilloscope traces give indications of the circuit's precision
and speed. These traces are taken from Rev. 3.5c. Rev 3.6 provides considerable
improvements but I have not had time to update. Note that time series traces
are **not** averaged - these traces display per-pulse temporal characteristics.
Optical characteristics and optical feedback signal for the Cyclops driver were
provided by a Thorlabs PDA36 amplified photodiode set to 0 dB of transimpedance
gain. Measurements were performed using a single blue Osram golden dragon LED.
The current-feedback mode -3dB bandwidth was determined by applying a flat
noise signal over 50 MHz with mean = 1.0V and Vpp = 500 mV into the `SIGNAL IN`
port with maximal current gain. It occurs at around 2.3 MHz.
![Trigger (yellow), current (pink), and light power (blue) traces during
pulsed operation in current feedback mode. Input waveform is a 1 kHz 0
to 750 mV, 10% duty cycle square
wave.](./resources/cyclops3.5A_performance-1khz-750mA.png)
![Zoomed traces showing waveform 10-90% rise times. Optical rise time
statistics are shown at the bottom of the
image.](./resources/cyclops3.5A_performance-750mA-rise.png)
![Zoomed traces showing waveform 10-90% fall times. Optical fall time
statistics are shown at the bottom of the
image.](./resources/cyclops3.5A_performance_750mA-fall.png)
![Optical bandwidth in current feedback mode. -3dBm occurs at \~2.3 MHz.
Input signal was was noise, flat over 50 MHz, mean = 1.0V, Vpp = 500
mV.](./resources/cyclops3.5A_performance-bw.png)
\FloatBarrier
The following traces are the same as the previous ones except that the
amplified photodiode was used to provide optical feedback. The slowdown
compared to current feedback is due to a speed of the photodiode. A
faster amplified photodiode would provide crisper rise and fall times
![Trigger (yellow), current (pink), and light power (blue) traces during
pulsed operation in optical feedback mode. Input waveform is a 1 kHz 0
to 750 mV, 10% duty cycle square
wave.](./resources/cyclops3.5A_performance-1khz-750mA-optical-fb.png)
![Zoomed traces showing waveform 10-90% rise times in optical feedback
mode. Optical rise time statistics are shown at the bottom of the
image.](./resources/cyclops3.5A_performance-750mA-rise-optical-fb.png)
![Zoomed traces showing waveform 10-90% fall times in optical feedback
mode. Optical fall time statistics are shown at the bottom of the
image.](./resources/cyclops3.5A_performance_750mA-fall-optical-fb.png)
\newpage
## Head to Head Comparison
The following table provides a comparison between Cyclops Rev. 3.6 and
commercial LED drivers.
---------------------------------------------------------------------------------------------------------------------------------------
**Plexon** **Plexon** **Thorlabs** **Cyclops**
**LD-1^1^** **PlexBright^2,3^** **DC4100^4^** **Rev. 3.6**
--------------------------------------------------- -------------- ---------------------- ------------------ -------------------------
**Speed**
· 10-90% rise time^5^ (us) 49 76 ? <0.1
· 90-10% fall time^5^ (us) 39 89 ? <0.1
· Wost case dead time^5^ (us) 140 160 ? 1.0
· Small sig. -3dB bandwidth^6^ (kHz) 10.5 ? 100^7^ >2500
**Accuracy**
· Overshoot^5,8^ (%) 0 0 ? 1
· THD^9^ (%) 8.29 ? ? 8.2
· THD, Optical F.B.^9^ (%) N/A N/A N/A 0.41
**Power**
· Max current drive (mA) 1200 1100 1000 1500
**Features**
· Independent LED channels 1 4 4 1^10^
· Regulated current output Yes Yes Yes Yes
· Regulated optical output No No No Yes
· Prog. overcurr. protection No No Yes Yes
· Arb. waveform generation No Yes No Yes
· Independent DAC for each LED N/A No N/A Yes
· Manual pulse Yes No No Yes
· Manual continuos on No No No Yes
· Hardware IO None None None Ref. voltage,
sync,
Load current,
trigger,
expansion
ports
· LCD display Yes No Yes No
**Programmabilty**
· Open-source No No No Yes
· Driver N/A "Radiant" NI-VISA^12^ Arduino/Teensy
software^11^ based GUI
· PC Interface N/A GUI/USB cable GUI or API/USB Arduino IDE;
cable USB 2.0;
Serial
interface
· Waveform gen. performance N/A 10 kHz aggregate N/A 100 kHz/channel
update across update
channels
· OS compatibility N/A Windows Windows Windows,
Linux, Mac
**Cost** **\$700.00** **\$5300.00** **\$3059.0^13^** **\~\$450.00**^14^
------------------------------------------------------------------------------------------------------------------------------------
1. [Plexon LD-1](http://www.plexon.com/products/plexbright-ld-1-single-channel-led-driver)
2. [Plexon PlexBright](http://www.plexon.com/products/plexbright-4-channel-controller-radiant-20)
3. Essential drive circuit consists of an [Opal-Kelly XEM6001 FPGA De
board](http://www.opalkelly.com/products/xem6001/) tied to 4
commercially available [buck converters from
Recon](http://www.recom-power.com/pdf/Lightline/RCD-24.pdf).
4. [Thorlabs DC4100](http://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=3832&pn=DC4100)
5. Test signal: 500 Hz, full off to on 50% duty-cycle square wave
resulting in 1A peak-to-peak through LED.
6. Test signal: 1 kHz 500 mA offset, 100 mA peak-to-peak sine wave.
7. Not measured on the bench top. Taken from manufacturer's specifications.
Bandwidth threshold (e.g. -3 dB) was not specified. Applies to sine
wave only.
8. Relies on short, low-inductance cabling. Longer cabling will degrade
performance.
9. Test signal: 1 kHz 500 mA offset, 1A peak-to-peak sine wave.
10. However, PCB is modular. Up to 4 PCBs can be stacked using included 0.1"
headers to share the same power supply and allow sychronous DAC operation of 4
light sources.
11. [Radiant Software](https://plexon.com/plexbright-radiant-v2-0-for-optogenetic-stimulation/)
12. [NI VISA](https://www.ni.com/visa/)
13. Includes the cost of the
[DC4100-HUB](http://www.thorlabs.com/thorproduct.cfm?partnumber=DC4100-HUB)
which is required to drive four LEDs.
14. Cost of fully assembed device from [Open Ephys
Store](http://www.open-ephys.org/store/cyclops-led-driver). Parts cost is
~\$170.00.
\newpage
# Usage {#usage}
The cyclops is a device that is capable of transforming voltage signals (e.g.
sine waves, square pulses, etc.) into optical signals from high-power LEDs or
laser diodes. Voltage signals to drive the device can be generated internally
using an on-board digital to analog converter or can be delivered from an
external source, such as a function generator or stimulus sequencer. The
cyclops provides numerous measurements of circuit operation that can be
recorded during an experiment such as LED current and stimulus reference
voltages. The device can also be controlled over a USB interface using its
onboard, Arduino-compatible [Teensy
3.2](https://www.pjrc.com/teensy/teensy31.html#specs) microcontroller board in
combination with the Cyclops Arduino library: `./lib/cyclops`. The device can
be used to drive commercially available LED modules from Thorlabs and Doric
using its expansion ports.
Below we provide device control and input/output definitions, an explanation of
the operational modes of the device, and the different ways it can be used to
generate optical stimuli. Refer to the above diagram to locate the physical
switches, dials, and connectors corresponding to verbal or iconic descriptions
device settings.
## Control and IO Definitions
Please refer to the [IO diagram](#fig-io) while reading these definitions.
**`REF OUT`: **
This output operates in two modes depending on the position of the slide switch
below the BNC connector:
- When the switch is set to SYNC, this output is set to 5V when the LED is on
(>10 mA) and 0 volts when off.
- When the switch is set to V. REF, this output will copy the reference signal
that the current source attempts to follow _after_ it has been subjected to
the GAIN setting. In constant current mode, this means that the voltage at
this pin specifies 1 A/V. During successul operation in Current F.B. mode,
this signal will match that off `LED CURR`. During successul operation in
`AUX F.B.` mode, this signal will match that of `AUX OUT`.
**`LED CURR.`: **
The voltage on this output measures to the current passed by the load at 1 V/A.
**`AUX. OUT`: **
This output provides a buffered version of the signal at the
`AUX. IN` connector.
**`SIGNAL IN`: **
To use this input, the `INPUT SELECT` toggle switch must be set to `SIG. IN`.
This input operates in two modes depending on the position of the verical slide
switch below the BNC connector:
- When the slide switch below the `SIGNAL IN` connector is set to the square,
triangle, sine icon, `SIGNAL IN` is used to provide an external target
voltage signal for the feedback circuit that drives the load. This voltage is
always subjected to the attenuation imposed by the `GAIN` dial.
- When the local switch is set to 5V CONT, 5V is generated internally and
constantly as a reference to drive the load and, again, is subject to the
GAIN setting.
**`TEST`: **
When this button is pressed, the `SIGNAL IN` line is temporarly disconnected
from the BNC connector and tied to an internal internal 5V reference. This
reference is then subject to the current `GAIN` setting as it would be if it
was produced externally and passed to the `SIGNAL IN` BNC.
**`GAIN`: **
Specifies the transimpedance gain between the reference voltage at `SIGNAL IN`
or produced by the DAC and currented to the load. During `CURR F.B.`, the gain
is given by:
$$
Load\ Current = Dial\ Position * \frac{SIGNAL\ IN\ Voltage }{5V}
$$
During `AUX F.B.` operation, the gain depends on how the optical to AUX signal
conversion gain.
**`INPUT SELECT`: **
Select the source of the reference voltage. `SIG. IN` selects the `SIGNAL IN`
connector. `OFF` ties the reference voltage to 0 so that no current is driven
through the load. `DAC` indicates that the onboard DAC should be used in
concert with the integrated Teensy 3.2 to generate a reference voltage
waveform. Refer to the [Programming the Onboard Microcontroller](#sec-mcu)
section for details on how to do this.
![Cyclops panel defintions (Rev. 3.6).](./resources/device3.6_io-diagram.png){#fig-io}
\FloatBarrier
**`COMP`: **
This LED indicates that overcurrent compensation is being performed
by the integrated microcontroller. In this case, the load is toggled off to
mainain an _average_ (~100's of milliseconds time constant) current below the
maximimum specified by the firmware running on the Arduino. This value
defaults to 1A on devices purchased through the Open Ephys store.
**`LED ON`: **
This LED indicates that the load is passing more than 10 mA.
**`>1A`: **
This LED indicates that the load is passing more than 1A, a typical
upper limit for high power LEDs.
**`POWER`: **
This LED indicates that the device has power.
**`TRIG`: **
This input provides GPIO access to the onboard microcontroller. It
can be used as an input or output depending on how the microcontroller is
programmed. It has a bi-directional logic level converter. Output will be 5V
logic high. 5V or 3.3V logic input can be used.
**`AUX. IN`: **
Auxiliary feedback signal for use in auxiliary (e.g. optical)
feedback mode. This pin is pulled high when not in use which protects the load
if the user accidentally switches the device to AUX. feedback mode during
operation.
**`USB`: **
Programming and serial access to the onboard Teensy 3.2.
**`EXPANSION A`: **
0.1" pitch, IDC expansion header. Exposes several signals,
power rails and LED outputs. This can be used to create and integrated load
/photodiode amplifier, for instance.
**`LED OUT`: **
Main LED or laser diode output. Standard banana connectors are
used.
**`F.B. MODE`: **
Slide switch used to toggle the device between constant current (`CURR`) and
auxilary (`AUX`) feedback modes. See the [Feedback Modes](#sec-fb-modes)
section for a detailed explaination.
**`B.W. SELECT`: **
Bandwidth selection switch. When in the `LIM` position, the bandwidth of the
device is limited and one can expect ~1 usec 1A rise and fall times. If long
cables (> 0.5 m) are used between the device and the load, this option must be
used to ensure device stability. When set to `FULL`, the device operates at
full bandwidth with rise times in the 10s of nanoseconds. When operating a full
bandwidth, the user takes steps to ensure circuit stability: short low
inductance cabling to the load. See the [Bandwidth Selection](#sec-bw) section
for details.
**`POWER`: **
Power connector. Center positive, 15V supply with >2A current
sourcing capabilities. Batteries can be used but must be capable of handing
large load transients to maintain device stability.
## Feedback modes {#sec-fb-modes}
### Current Feedback Mode
To use current feedback mode, push the `F.B. MODE` slide switch to the `CURR`
position (![Current feedback mode.](./resources/curr_switch_icon.png)). Using
the circuit in current feedback mode ensures that the forward current across
the LED is precisely regulated according the voltage at the `VREF` pin. This
configuration is a standard method for driving LEDs because the relationship
between current and LED irradiance is smooth and monotonic. This means that
more current across the LED will generate more light power (while staying
within the LED's maximum ratings, of course). However, the relationship
between current and irradiance is not linear. For most LEDs, it looks like a
logarithmic function. Additionally, the efficiency of the LED is inversely
related to its temperature. So, as the LED operates and heats up, the amount of
light it produces drops even when the current is held constant. The severity of
an LED's temperature dependence and current/irradiance nonlinearity depend on
the type of LED (roughly, the color and who made it). These properties should
be clearly documented in the LED's data sheet. With a quality LED and proper
thermal management, the effects of temperature and static current/irradiance
nonlinearity are fairly minimal and can be ignored in most situations.
![Current feedback
configuration.](./resources/current_feedback_diagram.png)
### Auxiliary Feedback Mode
To use auxiliary feedback mode, push the `F.B. MODE` slide switch to the `AUX`
position (![Auxilary feedback mode.](./resources/aux_switch_icon.png)). When
extremely stable, linear control of light power is required, the auxiliary
feedback input can be used to used to compensate for the temperature dependence
and static nonlinearity of the current/irradiance relationship of the LED. For
example, when the auxiliary voltage is supplied by an amplified photodiode that
is somewhere indecent to radiation from the LED, or is sampled from the fiber
transporting LED light, the gate voltage is adjusted such that the measured
light power matches a DAC-supplied reference voltage. This is the case in the
circuit diagram. This configuration is referred to as optical feedback mode.
The [PDA36A](https://www.thorlabs.com/thorProduct.cfm?partNumber=PDA36A)
adjustable amplified photodiode from Thorlabs is a good option for supplying
optical feedback. However, you can make your own amplified photodiode for a
fraction of the price, and a design is included within the cyclops repository.
Optical feedback completely linearizes the relationship between a supplied
reference voltage and the light power produced by the LED by compensating for
the current/irradiance nonlinearities and temperature dependence.
![Optical feedback configuration.](./resources/optical_feedback_diagram.png)
## Bandwidth Selection {#sec-bw}
The Cyclops can be operated in two bandwidth modes: `FULL` and `LIM`. This
provides user-selectable control over the speed at which the LED can be turned
on/off.
### Full Bandwidth Mode
To operate the device in full bandwidth mode, move the `B.W. SELECT` switch to
the `FULL` position (![Full bandwidth mode.](./resources/full_switch_icon.png)).
When the device is operated at full bandwidth, the user can take advantage very
short turn on/off times (1.0 A in about 100 ns rise/fall times). Additionally,
continuously varying optical signals are accurately represented up to about 2
MHz. That said, Cyclops is a fairly high-power circuit. The currents and
voltage used to drive high power LEDs are many orders of magnitude (like 6 or
more...) greater than those recorded during electrophysiology experiments.
Also, the Cyclops is a fast circuit. Fast circuits hate long cables because
they introduce appreciable delays and parasitics that can adversely affect
operating characteristics. Very long cables will introduce ringing into light
waveforms with fast edges! Ideally, the LED should be right next to the
device. I typically mount my fiber coupled LEDs directly into the banana
sockets on the back of the device using copper-clad printed circuit board so
that my 'cables' are about 2 cm in length. In any case, the following is
allways good advice: **keep the cabling to the LED as short as possible and
'fat' enough to handle high currents (AWG 18 or thicker)**.
### Limited Bandwidth Mode
To operate the device in full bandwidth mode, move the `B.W. SELECT` switch to
the `LIM.` position (![Limited bandwidth bandwidth
mode.](./resources/lim_switch_icon.png)). In this mode, the feedback circuit
within the cyclops will operate at lower speeds. This is useful in situations
where the use wishes to place the Cyclops device far away from the LED being
driven (e.g. when it is mounted on the head of an animal rather than light
being transmitted via optic fiber). In this case, the bandwidth of the device
can be lowered to avoid ringing and instability when a long, potentially thin
cable is used. I have driven LEDs at 1.5A over AWG 30 cable that is several
meters long without issue in bandwidth limit mode. This would cause the device
to oscillate wildy in full bandwidth operation. When the device is operated in
bandwidth limit mode, the rise and fall times of LED pulse will increase to
about 1.5 microseconds, and the -3 dB bandwidth will degrade to ~200 kHz or so.
This is plenty fast for almost all neuroscience applications.
## Stimulus Generation Options
There are three ways to generate light signals using the driver. The
behavior of each of these options is dependent on the feedback mode
being used. The behavior of each input option is described in relation
to the feedback mode of the driver.
1. ![Test button.](./resources/test_button_icon.png): The test button is
always available and will override all other input modes. Using the
`TEST` button the behavior of the circuit is:
- ![Current feedback mode.](./resources/curr_switch_icon.png): Source
the current specified by the `GAIN` dial.
- ![Auxilary feedback mode.](./resources/aux_switch_icon.png): Generate
the optical power specified by the _h_ \* mW level that is specified
by the `GAIN` dial. The intensity of the LED will be dependent
on the auxiliary feedback signal used which defines the
'h' parameter.
2. ![EXT mode.](./resources/ext_toggle_icon.png): External input mode is
engaged when the `INPUT SELECT` switch is moved to the `EXT` position and
user supplied voltage waveforms are present at the `EXT` BNC input.
If the user attempts to supply more than 5V to the `EXT` input, the
circuit will clamp the input signal to 5V. Using `EXT` mode, the
behavior of the circuit is:
- ![Current feedback mode.](./resources/curr_switch_icon.png): Source
the current specified by:
$$
Load\ Current = GAIN\ Position * \frac{SIGNAL\ IN\ Voltage }{5V}
$$
- ![Auxilary feedback mode.](./resources/aux_switch_icon.png): Generate
the optical power specified by:
$$
Power = GAIN\ Position * h * \frac{SIGNAL\ IN\ Voltage }{5V}
$$
The intensity of the LED will be dependent on the auxiliary feedback
gain which defines the _h_ parameter.
3. ![DAC mode.](./resources/dac_toggle_icon.png): The internal digital
to analog converter (DAC) is engaged when the `INPUT SELECT` switch is
moved to the `DAC` position and can be used to generate
pre-programmed waveforms and waveform sequences triggered by a
digital pulse to the `TRIG` input. This feature relies on optional
Arduino installation and programming the device using the [API](#sec-api). Using
the `DAC` mode, the behavior of the circuit is:
- ![Current feedback mode.](./resources/curr_switch_icon.png) Source
the current specified by:
$$
Load\ Current = GAIN\ Position * \frac{DAC\ Voltage }{5V}
$$
- ![Auxilary feedback mode.](./resources/aux_switch_icon.png) Generate
the optical power specified by:
$$
Power = GAIN\ Position * h * \frac{DAC\ Voltage }{5V}
$$
The intensity of the LED will be dependent on the auxiliary feedback
signal used which defines the 'h' parameter.
\FloatBarrier
\newpage
## Using the Onboard Microcontroller {#sec-api}
Cyclops devices include an onboard, Arudino-compatible microcontroller board
(Teensy 3.2) that can:
- Generate custom waveforms
- Respond to trigger input
- Provide background over-current protection
The Teensy can be programmed and uploaded to the device using the [Arduino
IDE](https://www.arduino.cc/en/Main/Software) in combination with the Cyclops
Arduino library: `./lib/cyclops`. _Note that you will need to add the
[Teensyduino add-on](https://www.pjrc.com/teensy/teensyduino.html) to to the
Arduino IDE to program the Teensy_. The Cyclops library contains several
examples to help you get started. The relevant public programming interface is
shown below. Functions are fully documented in the comments.
``` c++
// Each 'channel' defines a board address. A single microcontroller supports up
// to 4 stacked Cyclops boards.
typedef enum
{
CH0 = 0,
CH1,
CH2,
CH3,
} Channel;
// One Cyclops object should be created for each LED channel. For single LED
// devices (most cases) only CH0 is used.
class Cyclops {
public:
// Construct a Cyclops object
// chan: Cyclops channel to control
// current_limit_mA: Optional current limit for this Cyclops channel
Cyclops(Channel chan, float current_limit_mA = 1500);
// Program the DAC output register
// voltage: 12-bit integer (0-4095) specify the voltage to program the
// DAC with. Voltage is scaled into a 0-5V range.
// returns: 0 on success, 1 otherwise.
int dac_prog_voltage(const uint16_t voltage) const;
// Load the DAC output register to affect a voltage change on the output
// pin. This function affects all running cyclops devices that have had
// their DAC's programmed using the dac_prog_voltage() function.
static void dac_load(void);
// Convenience method for programming and loading a DAC voltage. Equivalent
// to calling dac_prog_voltage() followed by dac_load()
// voltage: 12-bit integer (0-4095) specify the voltage to program the
// DAC with. Voltage is scaled into a 0-5V range.
// returns: 0 on success, 1 otherwise.
int dac_load_voltage(const uint16_t voltage) const;
// Use the DAC to generate a period waveform
// sample_period_us: Sample period of voltage sequence in microseconds.
// voltage: Pointer to array of 12-bit integers (0-4095) specify the
// voltage sequence to program the DAC with. Voltage is scaled
// into a 0-5V range.
// length: Length of voltage sequence.
void dac_generate_waveform(const uint32_t sample_period_us,
const uint16_t *voltage,
uint16_t length) const;
// Get an LED current measurement in milliamps
// returns: LED current measurement in milliamps.
inline float measure_current(void) const;
// Attach/detach user provided interrupt function to TRIG pin
// mode indicates the pin trasition state at which the function is called,
// RISING, FALLING or CHANGED
// user_func: User define function specifying action to take when the
// TRIG pin transtions according the the mode arguement. e.g.
// can be a function that generates a wavefomr using
// dac_load_voltage() or similar.
// mode: Indicates the TRIG trasition state at which the user_func
// is called. Can be either RISING, FALLING, CHANGED, HIGH,
// or LOW. See AttachInterput() Arduino function for more
// detail.
void set_trigger(void (*user_func)(void), const int mode);
// Call this static method after creating all cyclops channels to start the
// internal overcurent protection engine and waveform generation machinery.
// This funciton is used to start all channels.
static void begin(void);
// *this's channel ID
const Channel channel;
};
```
\newpage
A simple example Arduino sketch, which uses the Cyclops to produce a [sinusodal
chirp](https://en.wikipedia.org/wiki/Chirp), is shown here:
```c++
#include <Cyclops.h>
#define PI_CONST 3.14159265358979323846
// Parameters of the chirp waveform
#define CHIRP_TIME_MS 5000 // Length of chirp waveform in msec
#define FREQ_START 0.5f // Start frequency in Hz
#define FREQ_END 30.0f // End frequency in Hz
// Create a single cyclops object. CH0 corresponds to a physical board with
// jumper pads soldered so that OC0, CS0, TRIG0, and A0 are used. Set the
// current limit to 1A on this channel.
Cyclops cyclops0(CH0, 1000);
// Chirp frequency ramp parameter
float beta = 1.0;
void setup()
{
// Chirp parameter
beta = (FREQ_END - FREQ_START) / (((float)CHIRP_TIME_MS) / 1000.0);
// Start the device and zero out its DAC
Cyclops::begin();
cyclops0.dac_load_voltage(0);
}
void loop()
{
// Calculate current chirp amplitude
float now = ((float)(millis() % CHIRP_TIME_MS)) / 1000.0;
float freq
= 2.0 * PI_CONST * (FREQ_START * now + (beta / 2.0) * pow(now, 2));
unsigned int voltage = (unsigned int)(4095.0 * (sin(freq) / 2.0 + 0.5));
// Program the DAC and load the voltage
cyclops0.dac_load_voltage(voltage);
}
```
\FloatBarrier
\newpage
# LEDs and Laser Diodes {#sec-led}
There are several things to consider when determining the type of LED or laser
diode you wish to drive with the Cyclops:
- Will optical stimulation be used in-vivo or through a microscope?
- Do you need to take advantage of the full device bandwidth or are slower (~1
usec) optical dynamics acceptable?
- Will it be performed on freely behaving animals?
- Do you need to perform bilateral stimulation?
- Will you need to incorporate an amplified photodiode into your
stimulator to measure optical power or use use optical feedback to
produce ultra precise light waveforms?
- What wavelength do you require?
- Will the LED or laser diode need a heatsink to maintain operation at the
power levels you require?
- Should light be launched into a fiber or placed directly at the target?
The answers to these questions will determine the type of LED or laser diode
you use, how it is coupled to the preparation (e.g. collimated for the back
aperture of your microscope objective lens or, fiber coupled for in-vivo
stimulation), and whether or not it needs to be commutated in some way. The
following provide a few simple options for LED configurations, but there are
many more to consider for your experiments.
![A simple 'pigtailed' LED module. A female SMA connector is cemented over a
lens-free high power LED to form a near optimal butt-coupling between the fiber
and the LED die.](./resources/fiber-coupled-led.png)
## Fiber-Coupled LED
### DIY Solution
Anders Asp has contributed the following PDF document containing detailed
instructions for fabricating a bilateral, commutated fiber-coupled LED for use
in freely moving animals that works with the Cyclops driver:
[Bilateral fiber-coupled
LED](https://github.com/andersjasp/cyclops/blob/master/resources/Open_source_fiber-coupled_bilateral_LED_for_in_vivo_applications.pdf)
### Thorlabs fiber-Coupled LED modules
The cyclops can be used to drive [Thorlabs fiber-coupled LED
modules](https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=5206).
You will need to install the [M8 4-position
connector](http://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=2615&pn=CON8ML-4#5315)
in EXPANSION PORT B to drive these LEDs. Solder the wires from the connector to
the cyclops PCB as shown in the following image __after__ you have
installed the connector into the rear panel of the device.
![Thorlabs LED M8 connector pinout](./resources/thorlabs-m8-connections.png)
### Doric LED fiber-coupled modules
The cyclops can be used to Drive [Doric fiber-coupled LED
modules](http://doriclenses.com/life-sciences/home/783-connectorized-single-led.html).
You will need to install the [M8 4-position
connector](http://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=2615&pn=CON8ML-4#5315)
in EXPANSION PORT B to drive these LEDs.
TODO: Pictures/instructions for M8 installation process in Doric
configuration
## Microscope mounted LEDs
The cyclops can be used to Drive [Thorlabs collimated
LEDs](http://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=2615&pn=CON8ML-4#5315)
for microscope-based stimulation. You will need to install the [M8
4-position
connector](http://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=2615&pn=CON8ML-4#5315)
in expansion port B to drive these LEDs. See [Thorlab fiber-coupled LED
instructions](#thorlabs-fieber-coupled-led) for instructions.
## Laser Diodes
In addition to LEDs, cyclops can be used to drive laser diodes. This can be an
appealing alternative to DPSS lasers for optogenetic stimulation. Cheap DPSS
lasers common for optogenetic use typically have very poor power stability and
temporal control characteristics. Laser diodes driven by cyclops behave
similarly to LEDs but offer much better fiber coupling efficiency. It is easy
to produce 100's of mW at the fiber tip simply by butt-coupling to a laser
diode. Alternatively, a [focusing
tube](https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=1379) can be
used to launch laser diode light into a bench top fiber-coupling system as a
direct replacement for a DPSS laser. Further, due to the cyclops' on/off speed,
a collimator can be used to send LD light into a 2P imaging system in between
row scans. This process occurs so quickly that it is averaged out by the opsin
kinetics to look like continuous power.
![Thorlabs LD focusing tube](./resources/ld-focusing-tube.jpg)
\FloatBarrier
\newpage
# Construction
If you have questions during device assembly, please direct them to the
[open-ephys forum](https://groups.google.com/forum/#!forum/open-ephys)
so that others may benefit. Pull requests improving this documentation
are welcome.
This portion of the manual provides instructions for assembling a Cyclops
device. If you have any questions, do not hesitate to post them to the
open-ephys mailing list:
> https://groups.google.com/forum/#!forum/open-ephys
Also, __pull requests and bug reports are welcome__. I would love your help in
improving this device and its documentation!
> https://github.com/jonnew/cyclops/issues
## Components
### PCB {#sec-pcb}
Unpopulated Cyclops PCBs can be fabricated by uploading the [gerber
files](./cyclops/pcb/gerber/) to the PCB fabrication service of your choice. I have
had success with:
- [OSH Park](https://oshpark.com) - made in America, excellent quality.
Minimum of 3 boards per order
- [Seeed Studio](http://www.seeedstudio.com/service/index.php?r=pcb) - made
in China, passable quality. Minimum of 5 boards per order.
![A bare Cyclops PCB, top side, fabricated by Seeed
Studio.](./resources/cyclops3.5A_board1.jpg)
The layer of each gerber file is identified by its file extension:
*.GKO = board outline
*.GTS = top solder mask
*.GBS = bottom solder mask
*.GTO = top silk screen
*.GBO = bottom silk screen
*.GTL = top copper
*.G2L = inner layer 2 copper
*.G3L = inner layer 3 copper
*.GBL = bottom copper
*.XLN = drill hits and sizes
PCB stencils, which are useful for applying solder paste to the boards, can be
purchased from a service like [Seeed
Studio](http://www.seeedstudio.com/service/index.php?r=stencil) using the
gerber files located in `/cyclops/device/stencil/` folder. If you plan to hand solder
the board, or don't mind dispensing solder paste yourself, then you do not need
to purchase these stencils.
### PCB Bill of Materials {#sec-pcb-bom}
The PCB bill of materials is availabe on [this google sheet](https://docs.google.com/spreadsheets/d/1YQR_ujrZgILNx3XjomLKWgzDvirwKrKaRbVVzmBgk-s/edit#gid=1630015426)
### Other Materials
A complete device requires several additional components aside from the
assembled PCB itself. These pre-populated Digikey cart. These can be found
following the PCB parts on [this google
sheet](https://docs.google.com/spreadsheets/d/1YQR_ujrZgILNx3XjomLKWgzDvirwKrKaRbVVzmBgk-s/edit#gid=765977278).
These parts include
- An **extruded aluminum enclosure**, which houses the completed board. The
enclosure is recommended because the large voltages and current transients
used to drive high power LEDs can cause capacitive and inductive interference
with nearby recording equipment. Acrylic front and rear panels can be
purchased from Ponoko using the links supplied in the BOM. The instructions
below show how these plastic pieces are modified to provide proper electrical
shielding.
- **Custom heatsink**, a waterjet-cut aluminum heatsink. Designs can be found
in the `./device/heatsink` folder.
- **Teensy 3.2 MCU**, a 32-bit microcontroller development board. Can be
purchased [here](https://www.pjrc.com/store/teensy32.html)
- An **M8-4 connector** (Optional). This is a rather expensive connector that
allows cyclops to drive [Thorlabs LED
modules](https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=5206) or
[Doric LED modules](http://doriclenses.com/life-sciences/243-led-modules).
## Device Assembly Manual
### Required Parts and Tools
Before starting, please ensure you have the following components. Suggested
part numbers and suppliers are provided on this [google spreadsheet](https://docs.google.com/spreadsheets/d/1YQR_ujrZgILNx3XjomLKWgzDvirwKrKaRbVVzmBgk-s/edit?usp=sharing).
In the lists below, numbers (#XX) correspond to the labels on the image below.
1. Assembled Cyclops PCB (#6, 1x)
2. Extruded aluminum enclosure (#1,1x)
3. Enclosure panels (front: #20, 1x; rear: #21, 1x)
4. Rocker switch (#18, 1x)
5. 18 AWG silicone insulated hookup wire (#17, 2x)
6. Shrink tube (#19, 2x)
7. Gain knob (#7, 1x), jam nut (#8, 1x), and toothed washer (#9, 1x)
10. Button cover (#10, 1x)
11. Waterjet-cut aluminum heatsink (#13, 1x)
12. 6mm length, M3 thread-forming screws (#11, 11x)
13. Nylon washers (#12, 3x)
14. Silicon thermal compound (#4)
15. Thermal tape (#5)
16. Teensy 3.2 MCU board (#15, 1x)
17. 0.1" sockets for Teensy 3.1 (#16, 2x 1x14 pin; 1x 1x2 pin; 1x 2x7 pin SMD)
You will also need the following tools.
1. Scissors
2. Soldering iron
3. Hot air gun or lighter
4. T10 Torx key or driver (#2)
5. XX Allen key or driver (#3)
6. Teensy soldering jig made from breadboard with male headers (#14)
Additionally, to use your device once it is assembled, you will need:
1. An LED or laser diode to drive [Required]
- See the [LED/laser diode section](#sec-led) for options.
1. A power supply [Required]
- Any wall-wart, battery pack, or bench-top power supply providing 15-20 VDC
that can source >=2A will work.
- The power jack is __center positive__ (but reversing this will not ruin the
device, it just wont turn on).
- Look around and see if you have a wall-wart laying around the lab that
meets the specs. They are pretty common and the jack is likely to fit.
- [Digikey part number
1470-3096-ND](http://www.digikey.com/product-search/en?keywords=1470-3096-ND)
or equivalent is a good option for those that need to buy a supply.
1. An M8, 4-pin connector [Optional]
- An inexpensive, standard, non-insane, 2x5 header (`EXPANSION A`) provides
access to most of the internal signals on the Cyclops board, e.g. for
driving an LED or providing auxiliary feedback using an amplified
photodiode etc.
- An expensive, strange, moderately insane, M8 expansion connector that is
used by two major companies in the optics space (`EXPANSION B`) is left
unpopulated. You can populate this port if you wish to drive Thorlabs or
Doric LED modules using the Cyclops. For instructions, see this the
complete manual.
![Cyclops device parts and tools](./resources/device-components-labeled.png)
\FloatBarrier
### Device Assembly Instructions
1. Assemble the teensy 3.2
![Teensy MCU assembly](./resources/teensy-assembly-steps.png)
- Solder the surface mount, 2x7 pin header to the bottom of the teensy. It
is important to do this first because its very hard to get to after the
other headers are installed.
- Put the single row headers on the soldering jig (panel 2, above),
followed by the Teensy (panel 3, above). The microcontroller chip should
be facing up.
- Solder the headers in place.
2. Assemble the power switch
![Power switch assembly](./resources/switch-solder-steps.jpg)
- Strip about 1 cm of insulation from each end of the hookup wires
- Thread the stripped portion of the wire halfway through each of the
switch's solder terminals. Fold the wire back, so that the stripped part
is touching both sides of the terminal.
- Solder the hookup wire to the terminals. Make sure the solder flows
between the wires' copper braid and the switch terminals.
- Slide the heat shrink from the back of each wire, over the solder joints.
Hit then with a hot air gun or pass a lighter underneath them to shrink
them into place over the solder joints.
3. Prepare the back panel
![Power switch installation](./resources/switch-install-steps.jpg)
- Press the power switch into position on the back panel. Orient the
switch so that the 'on' symbol (-) is toward the middle of the panel and
the 'off' symbol (o) is toward the outside. This will make the panel
easier to mount on the enclosure.
- The switch will snap into place.
4. Install the teensy on the cyclops
- Press the previously assembled teensy onto the 0.1" pitch male headers. It
should be _upside down_ on the bottom of the cyclops PCB.