I am working on a project which uses a set of sensors (HC-SR04). These sensors use pins 2 to 13 of the Arduino Uno. Here you can find the board:

enter image description here.

I also want to add an MP3 shield (VS1053B) to it and it fills all the pins on Arduino. So I decided to add an Arduino Mega and add the sensors to it and use the Arduino Uno and MP3 shield. The problem is with connecting these two Arduinos. As I said the MP3 shield fills A4 and A5 pins too, so I can not use them to communicate with the Mega. What other options do I have?

  • the MP3 shield you linked doesn't use A4 and A5 – Juraj Jan 31 '18 at 16:58
  • and perhaps it can be used on Mega with changed pin mapping – Juraj Jan 31 '18 at 17:03
  • @Juraj but it fills all pins when I put it on Arduino, – Majid Hojati Feb 1 '18 at 10:25
  • @Juraj actually I am thinking about using only MEGA, But I have no idea about changing pin mapping – Majid Hojati Feb 1 '18 at 10:25
  • the SPI pins should the shield connected over the ICSP header. it is on the same place on Uno and Mega. the helper pins are then connect to other gpio pin numbers on Mega. – Juraj Feb 1 '18 at 10:36

You can multiplex the trigger line. With 3 pins you can address up to 8 sensors. If you multiplex the reply line as well (so you can abstract out the latency) you only need 2 additional pins for the actual trigger and reply.

| improve this answer | |
  • So I do not need Adruino mega anymore? Can you give me a link about multiplexing the trigger line?sorry I am new to adruino – Majid Hojati Jan 31 '18 at 10:20

Salam, you could somewhat multiplex the HC-SR04 Ultrasonic Sensor by using I2C(IIC) instruction on how to convert those into I2C and by using OctoSonar library can be found here so that only the SDA(pin16) and SCL(pin17) pins on your Arduino UNO will be used. https://hackaday.io/project/19950-hc-sr04-i2c-octopus-octosonar

| improve this answer | |

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.