Electronics Design Laboratory Lecture #10, Spring 2016 ECEN 2270 Electronics Design Laboratory 1 Lessons from Experiment 4 • Code debugging: – Use print statement • Circuit debugging: – Re‐check operation of the speed sensor, driver, speed controller – Clean up the circuit • Neat layout helps reduce parasitics, reduces errors, helps in debugging • Drop short wires from Arduino pins down to the breadboard next to Arduino, then route connections neatly from there • Do not forget to include decoupling caps next to each chip • Include 1K (or larger) resistors between encoder outputs and Arduino interrupt pins • Use scope to check encoder pulses; noise may generate spurious interrupts ECEN 2270 Electronics Design Laboratory 2 Look Ahead: Project (Experiment 6) • About 3 weeks total, 6 sessions, including final demo • Must rely on fully functional Lab 2‐5 circuits • Must include an additional analog circuit‐design hardware component. Programming only add‐ons or enhancements do not count. • Some possible topics: – Additional sensors (light, IR, ultrasonic, audio, …) – Additional actuators (light, audio, …) – More advanced wireless control ECEN 2270 Electronics Design Laboratory 3 Experiment 5 and Final Project • Experiment 5 time will be split between preparing for your final project and designing a wireless controller for your robot • Final Project – Start working on final project ideas • Milestone 1 (week of March 28): informal discussion about project ideas • Milestone 2 (week of April 4): final project ideas and possible parts lists • Project proposal presentations due Sunday, April 10. Each group will present in class on Monday, April 11 • Written project proposals are due Wednesday, April 13 • Experiment 5 – Build the components of a wireless on/off and speed control circuit – Write code for the Arduino to receive/set a threshold on an analog control signal for on/off control and to measure the duty‐cycle of a digital input for speed control – Demonstrate wireless on/off and speed control of the robot ECEN 2270 Electronics Design Laboratory 4 Wireless Control 5VDC 5VDC 5VDC Wireless Controller Transmitter Receiver 5VDC Robot (Arduino) vrx vtx 0 0 433.92 MHz RF • Wireless controller generates PWM signal to be sent to Robot • Wireless channel: use transmitter and receiver boards to encode and transfer signal vtx to receiver side vrx wirelessly • Receiver translates RF signal into a 0‐5V signal • Robot Arduino receives the same PWM signal that was sent by the wireless controller ECEN 2270 Electronics Design Laboratory 5 Wireless Transmitter/Receiver 1. 2. 3. • • • • Series of pulses is sent to the wireless transmitter When input is high, transmitter outputs a 434MHz signal. This signal is applied to the transmitters antenna and travels through the air A receiver tuned to the same frequency outputs a high value when it senses a signal on its antenna vtx 0 RF vrx 0 Wireless transmitter modulates a signal at a specific frequency This is OK if only one person needs to transmit at a time If a lab full of people all try and transmit at 434MHz… Need a way for everyone to use the same frequency without interfering with each other ECEN 2270 Electronics Design Laboratory 6 Wireless Transmitter/Receiver • Modulate our modulated signal! • Our transmitters have a center frequency of 434MHz • Switch this signal on an off at a much lower frequency creates side‐bands • These sidebands can then be filtered out later • Solution for single transmission frequency in a busy lab – Each group will have its own modulation frequency – The RF spectrum of the lab will then be filtered for that frequency ECEN 2270 Electronics Design Laboratory 7 Wireless Transmitter/Receiver Data 1/fm vtx 1/fc RF vrx Data • Carrier frequency fc is fixed at 434 MHz • Modulation frequency fm is between 400 Hz an 1 kHz • By filtering vrx the sent data can be re‐created ECEN 2270 Electronics Design Laboratory 8 Wireless Control: Six Blocks Needed 5VDC Wireless Controller 5VDC Modulator 5VDC Transmitter Receiver 5VDC Filter Robot (Arduino) 433.92 MHz RF Wireless Controller generates high/low signal Modulator turns high/low into pulsed waveform at frequency fm Transmitter generates RF signal at 433 MHz Receiver receives RF signal at 433 MHx Filter removes all frequency that we didn’t send, i.e. all frequency other than fm – Robot does stuff – – – – – ECEN 2270 Electronics Design Laboratory 9 Wireless Control 5VDC Wireless Controller 5VDC Modulator Transmitter 5VDC Receiver 5VDC Filter Robot (Arduino) • Inputs: on/off • Outputs: 0‐5 V PWM signal at fm ECEN 2270 Electronics Design Laboratory 10 Wireless Control 5VDC Wireless Controller 5VDC Modulator Transmitter 5VDC Receiver 5VDC Filter Robot (Arduino) fm = 1.44/(C*(RA+2RB)) D = (RA+RB)/(RA+2RB) Output vtx 5VDC 1/fm RA RB < ½RA Input Data C = 0.01μF 0.01μF Astable Operation ECEN 2830 Electronics Design Laboratory 11 Wireless Control 5VDC Wireless Controller 5VDC Modulator Transmitter 5VDC Receiver 5VDC Filter Robot (Arduino) • Input: 0‐5 V PWM signal at fm • Output: messy signal containing many frequencies in additional to the one we want ECEN 2830 Electronics Design Laboratory 12 Transmitter (Tx) WRL‐10534 4 3 2 1 876 5 4321 1234 5 6 78 1 23 4 Pin 1: GND Pin 2: Data In (0‐to‐VCC pulses vtx) Pin 3: VCC (5V to 10V) Pin 4: Antenna ECEN 2270 Receiver (Rx) WRL‐10532 Pin 1: GND Pin 2: Data Out (0‐to‐Vbat pulses vrx) Pin 3: analog out (not used in the experiment) Pin 4: +5V (NOT 10V!!) Pin 5: +5V (NOT 10V!!) Pin 6: GND Pin 7: GND Pin 8: Antenna (about 13 ‐ 17cm) Electronics Design Laboratory 13 Transmitter & Receiver Design Notes • Follow standard circuit prototyping practices: connect all supply and ground pins, include decoupling capacitors in the close proximity of the supply pins (47 F electrolytic and 0.1 F ceramic) • If data input vtx pulses are too long (more than about 10 ms), or too short (less than about 0.5 ms), the receiver output vrx will be noisy • Performance will depend on Tx and Rx location and distance. Wire antennas can be used to improve performance (note: /4 = (c/f)/4 = 17 cm) • Tx and Rx can be tested separately using the lab waveform generator, and two lab power supply voltages (set both to +5V) • Multiple transmitters operating at the same time will interfere with each other ECEN 2270 Electronics Design Laboratory 14 Wireless Control 5VDC Wireless Controller 5VDC Modulator Transmitter 5VDC Receiver 5VDC Filter Robot (Arduino) • Input: Messy signal containing many frequencies in additional to the one we want • Output: High when fm is present at input, low when fm is absent from input ECEN 2270 Electronics Design Laboratory 15 Wireless Control 5VDC 5VDC Wireless Controller Modulator 5VDC Receiver Transmitter 5VDC Filter Robot (Arduino) • Bandpass filter will attempt to remove all frequencies that we don’t want Gain Passband Gain Center Frequency Quality Factor ‘Q’ determines how wide peak is. High Q means narrow passband. 1 fm ECEN 2830 Electronics Design Laboratory Frequency 16 Wireless Control 5VDC Wireless Controller 5VDC Modulator 5VDC Receiver Transmitter 5VDC Filter Robot (Arduino) • Bandpass filter will attempt to remove all frequencies that we don’t want Gain Gain Group Y Group X 1 1 fm ECEN 2270 Frequency Electronics Design Laboratory fm Frequency 17 Wireless Control 5VDC 5VDC Wireless Controller Modulator 3 5VDC Transmitter 5VDC Filter Receiver Robot (Arduino) 1 2 10nF R3 10nF R1 5VDC 2 3 R2 47kΩ 5VDC 47kΩ ECEN 2270 0.1μF Electronics Design Laboratory 18 Band‐Pass Filtering Group X Gain Group Y Group X 1 My Robot fm Frequency fm Frequency Gain Group Y 1 ECEN 2270 Electronics Design Laboratory 19 Wireless Control 5VDC 5VDC Wireless Controller Modulator 5VDC Transmitter Receiver 5VDC Filter Robot (Arduino) 1 10nF R3 10nF R1 5VDC 2 3 R2 47kΩ 5VDC 47kΩ ECEN 2270 0.1μF Electronics Design Laboratory 20 Output of Band‐Pass Filter My Robot – 4.3V Output 5VDC Receiver R3 10nF Filter Robot (Arduino) Group X – 2.8V Output 10nF R1 5VDC Peak Detector 5VDC 2 4 R2 3 Group Y – 3.4V Output 47kΩ 5VDC 47kΩ ECEN 2270 0.1μF Electronics Design Laboratory 21 Amplitude Detector: Peak Detector and Comparator 5VDC 5VDC Wireless Controller • Modulator 5VDC Receiver Transmitter Input: Messy signal containing many frequencies in additional to the one we want 10nF R3 10nF R1 5VDC • 5VDC Filter Robot (Arduino) Output: High when fm is present at input, low when fm is absent from input Peak Detector Comparator Input 5VDC R2 Output 47kΩ 5VDC 47kΩ ECEN 2270 0.1μF 5VDC R5 Electronics Design Laboratory R4 0.1μF 22 Amplitude Detector: Peak Detector and Comparator • Input: Messy signal containing many frequencies in additional to the one we want • Output: High when fm is present at input, low when fm is absent from input Input Output 10nF R3 10nF R1 5VDC Peak Detector Comparator Input 5VDC R2 Output 47kΩ 5VDC 47kΩ ECEN 2270 0.1μF 5VDC R5 Electronics Design Laboratory R4 0.1μF 23