H2MAA
  • About Me
  • Weeks
  • Final Project

Week 12: Networking & Comms

For my final project I need to interface between 2 PCs and a microcontroller (MC). I send a synchronized trigger pulse from the behavior PC to the imaging PC and MC.

Devices:

  • behavior PC
  • imaging PC
  • microcontroller (arduino)
  1. python script on behavior PC

    • send start and stop signal to MC and imaging PC
    • prompt user to input session parameters
    • file handling
    • collect and save behavioral data
  2. NIDAQ

    • send trigger signal from behav PC to imaging PC
    • record and port digital signal from arduino to behav and imaging PC
  3. Arduino (MC)

    • real time rig control: .ino script directly measures capacitance data and triggers solenoid opening
    • sends digital signal to behavior PC and imaging PC (via NIDAQ) to report solenoid valve open time. this signal will be used to synchronize behavioral data and imaging data
# Create a task to send the digital pulse
with nidaqmx.Task() as task:
    # Add a digital output channel
    task.ao_channels.add_ao_voltage_chan(f'{card_id}/{channel}', name_to_assign_to_channel=f'AnI1_{microscope}')
    task.write(0.0)
    task.write(5.0)
    time.sleep(pulse_duration) 
    task.write(0.0)
    print(f"Analog trigger sent to {card_id}/{channel} for {pulse_duration} seconds.")
© H2MAA 2025