Arduino, PLX-DAQ, looping variable due to lickometer sensor issue

hello !

context:
i am using a lickometer with two photoemitters that sustain an infrared (IR) photobeam across the spout of the sipper tube. When the beam is broken (presumably when the mouse is drinking from the sipper tube), the Arduino program records a lick using the lickCount variable.

the issue:
i use PLX-DAQ to record data and noticed that lickCount was looping even though there was nothing breaking the IR beam. I disconnected PLX-DAQ, opened the Arduino IDE, and checked the Serial Monitor to confirm the issue persisted. it did :frowning:
there is a LED light wired to the lickometer that should light up when the IR beam is broken, but it does not light up even though lickCount is increasing.

hardware troubleshooting
we rewired the entire lickometer sensor because loose or damaged wires was our first guess. then we reinforced the lickometer with a special plastic wrap to avoid mouse chewing through wires.

software troubleshooting
we connected various ports, tried isolating each variable, debugging the code etc.

thoughts
here's what we thought could be the issue:

  • program delay somehow
  • sampling rate
  • problem with photoemitter

does anyone know what could be happening here?
PS new to arduino forum so using faqs for appropriate forum etiquette, please have patience for my mistakes and let me know if there is anything i can/should provide for better clarity

thank you very much to my fellow programmers, engineers, and friends on this forum!

The execution flow may loop, but variables don't "loop".

1 Like

Your problem is not unexpected, and your wiring may be the root cause. Since hardware is involved, it’s crucial to provide an accurate, annotated schematic of your circuit as it is currently wired. Please note that Fritzing diagrams are not considered proper schematics; they are wiring diagrams and are often not helpful for troubleshooting.

What to Include:

  1. Annotated Schematic: Show all connections, including power, ground, and power sources. This helps us understand how your circuit is set up and identify any potential issues.
  2. Technical Information Links: Provide links to technical documentation for each hardware device used in your setup. Avoid links to sales sites like Amazon, as they usually lack the necessary technical details. We need complete specifications to help you effectively.
  3. Additional Information Needed: If the above details are incorrect, more information is required. Tell us what hardware and software you are using, the format of any data (like map data), and how your system determines its position. For example, if your project involves a robot, describe how it navigates and what computers are involved.

Why This Matters:

We have no way of knowing the specifics of your setup unless you provide that information. Clear and detailed descriptions enable us to offer the most accurate help possible. Without these details, it’s difficult to diagnose and solve the issues you're experiencing.

How to Get the Right Help Faster:

You can spend weeks spinning your wheels, or you might get lucky and solve your problem quickly. To avoid unnecessary delays, it’s crucial to provide an annotated schematic of your circuit as you have it wired, showing all connections, including power, ground, and supplies.

Why Detailed Information Matters:

  • Annotated Schematics: These are essential because they show exactly how your circuit is set up. Without them, it's difficult for anyone to understand what you’ve done, which makes troubleshooting nearly impossible. Fritzing diagrams or unclear pictures are not enough.
  • Technical Information: Many modules look similar and may even have the same name, but they can function differently. This is why we always ask for links to detailed technical information—not just sales pages like those on Amazon, which often lack the specifics we need.
  • Show All Connections: It’s important to include every connection, especially power and ground, in your schematic. Missing these details makes it hard to determine if a setup issue might be causing your problem.

My Process:

When I see a question, I spend a moment assessing it. If it’s missing critical information, I might ask for it. However, if it's repeatedly lacking important details, I may assume the questioner is not serious and move on to another query.

What You Need to Consider:

We don’t know your skill level or what resources you have available. If you’re missing key technical details or seem unprepared, it may indicate that you need to spend more time learning the basics before starting your project.

Providing the right information upfront will help you get the best possible assistance and avoid the frustration of running into dead ends. Let us help you by sharing what you have clearly and completely!

Thank you so much for your kind reply - I am completely new to online forums for getting help and I know what to provide now.

This is a group project for a lab , so I need certain permissions to share code. Will provide as soon as I can!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.