0

My robotics class is trying to take signals from a MyoWare Muscle Sensor and feed them to a Raspberry Pi Zero. For ADC, we are using a MCP3008 chip.

Because most people use Arduinos for these sensors, we can't find any example code or libraries. Does anyone know of a place where we can start, code-wise? We are trying to use c++.

  • You will need to write code to get the values from the HAT. I don't see how we can help given the lack of provided detail. – joan Jan 31 '18 at 21:36
  • @joan What details do you need me to provide? I don't know if there are any libraries for this, so I'm just asking where to start. I don't have any code yet. – TrumpetDude Jan 31 '18 at 21:38
  • It's implicit here that either anyone who could possibly give you any help must already know what a "MyoWare Muscle Sensor" is, or that you figure it is easy enough for others to spend time researching it themselves because they are so eager to be of service ;) Most likely, neither of these things is true, so it might behoove you to explain a little more about what the device outputs and how it is attached to the pi (you mention an ADC, but...). – goldilocks Feb 2 '18 at 20:22
  • @goldilocks I have added all of the information I have to the question. I have been researching this myself for weeks, and since I haven't been successful, I thought I should ask about it on a website designed for people eager to answer questions and help other people with Raspberry Pis. I appreciate your feedback on my question, and will continue to add more information if I find any more relevant information. – TrumpetDude Feb 2 '18 at 21:15
  • 1
    learn.adafruit.com/… – Janka Feb 2 '18 at 22:38
1

This is a minimal example in C how to interface an I²C chip (a DS7505 in that case) without any further libraries. You have to read the MCP3008 datasheet, then tweak that example program as you need it for your chip.

  • I just saw the MCP3008 is SPI rather than I²C, so my answer doesn't match. Please remove your tick so I can delete it. – Janka Feb 2 '18 at 23:34
  • I think the general point is clear enough. There is a link to a Raspberry Pi based example on the Adafruit page; it's in python but even if you don't program in it (I don't) python is not hard to read (in addition, parts of the modules will be in C). Further, the Pi specific C libs (e.g. pigpio) should have examples of SPI usage. Beware there's an MCP3008 example on the pigpio page that uses bit-banging, you probably don't want that, but it may help clarify how the ADC works together with the adafruit stuff and especially the datasheet. They are not super complex. – goldilocks Feb 3 '18 at 13:58
  • @Janka It's fine that its SPI. I will ad that as a tag. I had the question tagged I2C because we had been previously using that for the output of our project. – TrumpetDude Feb 7 '18 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.