Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Arduino Voodoo Adapter

Introduction
This small adapter board allows an Arduino Nano to be fitted in place of the PIC18F4520 microcontroller on the
Voodoo PCB.

Instead of the original implementation using a menu system and four pushbuttons to select various parameters, this
Arduino variant uses 3 potentiometers and one switch. In addition, the 2-line 16 character LCD has been replaced by a
1.3” OLED display. The existing LCD pins are connected to the adapter PCB, but these are not being used by the
Arduino sketch.

The intent here is to make the Voodoo technology more easily accessible to Geotech members who are not familiar with
Microchip PICs, and who do not have access to the Mikroelektronika mikroC Pro compiler.

Although there are some limitations imposed by the Arduino architecture, this small project was able to replicate the
same level of iron rejection as the original design.

The adapter board was designed using DipTrace, and there are Gerber files available for anyone wanting to experiment
with this variant. The PCB directly replaces the PIC microcontroller, and allows the Arduino Nano to connect to the
required pins on the main PCB. Since the Nano is used to provide the audio tone, there is one jumper wire required
under the main PCB to make the connection to the audio amplifier stage.

Connectors
There are 5 connectors on the adapter board:

• PL1: To provide power for the OLED display.


• PL2: To provide the required SDA and SCL signals for the OLED I2C interface.
• PL3: Main Sample Delay potentiometer (10k)
• PL4: Threshold potentiometer (10k)
• PL5: Disc Sample Delay potentiometer (10k)
There is a separate switch (which allows the user to select between Pulse and Hybrid modes) that is wired to PL6 on the
main Voodoo PCB. This connector was previously used by the Menu pushbutton.

Note that the Arduino Nano is oriented so that the USB connector is at the bottom of the adapter PCB. The pad for pin 1
for both the PIC and the Nano is square to distinguish it from the other pins.

In the initial REV-A version of the adapter board there were a number of errors due to not understanding some of the
limitations imposed on the Arduino Nano ports. As you can see from the image below, there was some considerable
hacking required to reassign several ports to different signals. These issues have been resolved in REV-B (shown
above). You may also notice that there are several components no longer required on the main PCB. These will be
detailed later in this document.
Arduino Nano Port Limitations
D0 and D1 are used by the internal hardware UART, and are therefore not readily available for use. Although these
digital ports can be used (with some restrictions) it prevents the use of Serial.print() for debugging purposes.

D13 is attached to an onboard LED, and can therefore only be used as an output. If it is unavoidable, and D13 has to be
assigned as an input, it requires an external pull-down resistor. The internal pull-up resistor should not be used.

A6 and A7 on the Arduino Nano can only be used as inputs.

The above points are rarely made clear, and there are numerous people experiencing problems and asking the same
questions in the Arduino forums.

OLED Display

The images above show the OLED in operation. This is a 1.3” Zoll display from A-Z Delivery. Note that they made an
error when labelling the I2C connections, and named the SCL pin as SCK.

This display uses an SH1106 controller and has 128x64 pixels. To use this display, you need to download the U8g2
library as follows:
In the Arduino IDE, go to Tools > Manage Libraries
Search for U8g2 and select U8g2 by oliver, and install.

There are 3 possible modes of operation for this display. Although I did manage to successfully port the implementation
of the non-ferrous / ferrous meter from the original LCD code, there were a number of problems discovered. The full
buffer mode allows graphics to be drawn on the display and is the fastest method, but although the Arduino sketch
would compile and upload, it refused to run due to lack of RAM. The non-buffered mode did run, but was too slow and
caused huge gaps in the audio response. The final mode is text-only and writes directly to the display. There is no buffer
in the micro required, and it can provide up to 8 lines of 16 characters. Despite this, the text-only mode still caused gaps
in the audio response when the non-ferrous / ferrous meter was activated. Consequently the final solution in the Arduino
sketch does not provide a meter function. This was not found to be an issue though, as the Arduino version really does
knock out the iron.

Arduino Sketch
As before (in the mikroC Pro code) the interrupt routine in the sketch controls the various pulses using timer interrupts.
However, this time it only uses one timer (Timer1) for all samples and delays. This is not a direct port from mikroC Pro
to Arduino’s C++ language, as there are several differences which will become evident when you examine the sketch.
There are lots of comments in the code, so hopefully it will all make sense.
The audio signal from the Nano is generated on D3 which is connected to pin 21 on the PIC connector, and was
originally the DEBUG pin (TP2). A jumper wire needs to be soldered between TP21 and TP18 under the Voodoo PCB
to make a connection to the audio output stage, since U11 (NE555) is not used in this variant.

Components Not Required On the Voodoo PCB
1. The PIC version of Voodoo uses an NE555 to generate the audio tone. Since the Nano provides this tone
directly via a PWM output, the following components do not need to be fitted:
U1 (NE555), R67, R68, C31, C34, and C35.

2. Several components surrounding the PIC microcontroller are likewise not required:
U1 (PIC18F4520), XTAL1, R1, R3-R5, R7, R9, R11, R26, R41, C2, C4, C5, C7, JP1-JP3, PL3-PL5, PL9,
PL10, and the LCD.

Since C22 (22uF) causes a clash with the underside of the adapter board, it needs to be soldered on the bottom of the
Voodoo PCB. R23 and R24 should also be installed before the adapter board is soldered in place.

Finally
There will no doubt be many questions not answered in this short document. So for those who are interested, please post
comments in the forum.

You might also like