5

I'm building a line follower with arduino, here some part that I'm going to use

I'm using LiPo Batteries 3 Cell 11.1v for power source.

I'm new in here so I didn't know how to stack that shield, if I recall I can stack up Arduino and the LCD Keypad, and Arduino and the Motor Shield, but didnt know how to stack those 2 together and adding another sensor like that line tracking sensor. May I know how to resolve that? thanks.

2

2 Answers 2

3

The Motor Shield 2A plugs in on top of the Arduino Uno, and the LCD Keypad plugs in on top of the motor shield. [But see Edit 1 below]

There is better information about the 4 Channel Line Tracking Sensor at uctronics.com where you can see that its main board (with the LM339 chip) connects to the Arduino via six lines: Vcc, Gnd, Out1, Out2, Out3, Out4. That main sensor board does not mount on the stack, but instead can be located whereever is convenient and leaves its four comparator-level pots accessible for adjustment. Mount the four small boards for the tracking module as convenient and necessary for line following.

For connecting the six lines from the sensor main board to the Uno, you probably will need to solder two headers (rows of pins) to a board in the stack. Using right-angle headers (see below) will allow the pins to come out of the side of the stack without interfering with other layers of the stack. One of the headers should let you connect sensor Out1...Out4 digital outputs to four otherwise unused analog or digital pins, and the other header should let you connect Vcc and Gnd.

6-pin angle header, 0.1" spacing

Edit 1: In the LCD shield page, section 2 (Diagram) shows Vcc, Gnd, and D0-D3 available at the top right corner (the angled corner). Those six pins probably are a reasonable place to add a six-pin angled header for the sensor board.

Given that the LCD KeyPad Shield is a DFRobot.com model, the summary pinout at shieldlist.org shows that its use of D4,5,6,7 will conflict with use of those same lines by the DFRobot 2A Motor Shield. There are several ways to handle a conflict like this: 1, use two Uno's, one per shield; 2, make one shield or the other use different lines; 3, share the lines.

Method 2 could work as follows: Stack the LCD shield directly on the Uno (or any other compatible Arduino). Besides a header for the sensor board, add a header for a cable to the motor board, and drive the motor board's D4-7 inputs with some other lines from the Uno, eg A4-7. [Alternately one could remove the D4-7 pins on the LCD shield and jumper from A4-7 to the D4-7 lines on the LCD shield. This would leave the boards in a single stack but would make some serious changes to the LCD board.]

Method 3 would work as follows: The LCD shield only pays attention to D4-7 (which from the DFRobot schematic drive DB4-DB7 on an LCD TC1602 chip) when the TC1602's E line is strobed. See pages 7 and 8 of Adafruit.com's copy of TC1602 specs, where timing diagrams show about half-microsecond times for writing to or reading from the TC1602.

You would need to run tests with your motors and see if they work ok in spite of the four inputs to the motor shield being random during the occasional half-microseconds that data is being written to the LCD. You might have to add more diodes or capacitors to suppress electrical noise due to rapid switching.

DFRobot's motor shield page has links to that board's schematic and to its L298 chip data sheet. Page 7 of the datasheet says

An external bridge of diodes are required when inductive loads are driven and when the inputs of the IC are chopped; Shottky diodes would be preferred.

The motor shield schematic shows diodes; although not drawn using Schottky diode symbols they might be Schottky anyway (which would give better noise suppression, less heating, etc). The schematic also shows that JP1, a 16-pin dual row header, has jumpers that control ENA and ENB on the L298. In a "proper solution" for sharing D4-7 between the LCD and motor shields, you'd drive ENA and ENB low when using D4-7 for LCD i/o, which would allow the attached motors to briefly free run, as opposed to being suddenly commanded to stop or reverse.

5
  • Note, I didn't verify whether any of the LCD shield lines conflict with any of the motor shield lines. As asked earlier, what LCD Keypad are you using? Sep 9, 2014 at 20:51
  • LCD Keypad just like in DFRobot in here dfrobot.com/wiki/… I didn't know how to attach the additional header pin because the top of stack is LCD Keypad and didnt know where to use it Sep 11, 2014 at 3:45
  • kripton, see edit Sep 11, 2014 at 5:56
  • based on your method, can I use ardu nano or mini? cause I only have 1 uno at a time. or maybe can I use shiftout just like in this tutorial? arduino.cc/en/tutorial/ShiftOut thanks anyway Sep 11, 2014 at 8:42
  • Neither shield can directly plug into a Nano or Pro Mini (which are about 1/3 as wide as an Uno) but would instead need cables or an adapter shield. In that case you might as well use a cable from Uno to motor shield. The Uno has enough lines to do it all. See edit about "Method 2". Sep 11, 2014 at 15:20
1

The most elegant approach would probably be to use shields controlled by the I2C bus. I've found LCD+keypad and motor shield offered by Adafruit for example.

The I2C bus is shared by all slaves connected to it, and you should find microswitches on each shield to set its I2C address.

Regular shields should not interfere with I2C lines, so as last resort you can put one shield controlled "traditional way".

2
  • By in case of trouble finding do you mean when you need to do some trouble shooting or if you encounter any problems? Mar 26, 2016 at 7:17
  • @Greenonline sorry for imprecise language, I meant "trouble finding I2C controlled shield for your purpose" and I have edited my answer. Mar 27, 2016 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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