Page 005 The test board - johnmholmes/Arduino-CBUS--Introduction-Series GitHub Wiki

Last updated 10/10/24

Here you can see the test board I have started to use for the series of videos.

IMG_3289

The various items I buy from AliExpress which keeps the cost below £6 per module. The use of Arduino Nano clones has not caused me any issues. It is important to ensure you buy the following version ATMEGA328P CH340 and not the smaller ATMEGA168. You made need to install the windows CH340 driver. Also if you find that the sketch hangs during uploading of the sketch you will need to change the processor type.

cb3

An Arduino Nano

download

  • I use cheap Arduino Nano clones which are available from Ali-express relatively cheaply, yes you will have to wait a weeks or two for delivery, however this hobby is slowly getting very expensive if you go down the commercial routes.

  • The Nano offer I feel plenty of general purpose input output pins (gpio)

  • The Mcp2515 module will require the use of 5 gpio pins to work.

  • You may find you need to change the boot loader setting in the Arduino I D E to be able to upload to them.

  • The pre-solder pins make this very easy o use with an Arduino Nano shield or a bread board for prototyping.

Arduino Nano Pinouts

Screenshot 2023-12-12 055743

  • Here you can see the Arduino pinout from the official Arduino website.

  • Most pins have multiple uses more details can be found in their datasheet here.

  • See section 5 for the connector pinouts page 9.

  • Be careful when working with the GPIO's they have a maximum dc current of 20 milliamps per pin, however there is a total maximum which is suggested as 200 milliamps for the whole unit.

  • For are experiments we will be using the USB lead to work with the Arduino IDE for serial print messages for debugging the sketches and to see what is happening. By doing this it does mean we can not use pins 0 RX and pin 1 TX

  • We will also be using pin 2 for the interrupts used for Can messages received.

  • We will be using Pin 10 for the Serial Peripheral Interface (SPI).

  • Final the MCP2515 module requires pins 11,12,and 13 as well as a 5 volt and 0 volts(GND) to work.

  • This leaves the following pins free for our desired use 3,4,5,6,7,8,9 plus the 8 analogue A0 to A7. one thing to remember is pins A6 and A7 can only be used for inputs.

This means we do need to find away of connecting the peripherals to these pins, one issue is the lack of GND pins. To get around this I use the readily available Arduino Nano sensor shield.

The Arduino Nano Sensor Shield

nano_sensor_shield

I buy these also from Ali-express the last ones cost me £2 approximately

  • These offer many advantages when working with the gpio pins

  • You can power the Arduino Nano using the on board power jack, I use a 12 volt dc power bus running around my layout boards. The unit has on board voltage regulators for 5 volts as well as 3.3 volts.

  • The unit works well with Dupont connectors making this a cheap way of working.

  • One word of caution when using peripherals be aware some modules are 3.3 volt tolerant only and the Arduino Nano pins are 5 volts. If working with 3.3 volts you will need to look at some form of voltage dividers.

Voltage divider

Screenshot 2023-12-12 063223

  • This picture shows one method for doing this.

The MCP2515 module

canmodule

Image courtesy of Chris Sharp.

This offers a away of sending and receiving messages through the twisted pair of bus wires.

  • It has 7 connectors we need to connect these to the right gpio pins on the Arduino Nano.

  • It also has connectors J1 for using the onboard bus terminator resistors. We need to use them at either end of the Can Bus for it to work correctly.