Last Updated: 24/08/2024

Welcome to Digital Town

 

Welcome to Digital Town. This site was started to help teach some youngsters how to program Arduinos and acted as a resource to some YouTube videos I had created.

Since then the site has grown as more videos and content has been added and is slowly being restructured to deal with the extra volume of content.

The site is now in 5 sections.

Home has a list of the latest content added.

Arduino/C++ Lessons are various tutorials on learning how to use and program using the Arduino IDE and is aimed at beginners.

Components is about how to use an individual component with some sample code to help you use them.

Projects focuses more around putting multiple components together as well as looking at the issues around building projects. The Model Railway projects are included in this page.

Reviews & Links
is just a link to items or websites I have found useful

I do try to add content as often as possible but this is a hobby so be patient.

Latest Updates

Arduino C++ Lesson 5B, Arduino UNO with toggle switches

This is an extra lesson that has been added to show how to control items with toggle switches with the Arduino UNO, rather than the usually push to contact switches that come in most kits.

As always the code is non blocking (state machine) style code and in the example a pair of LED's are turned on and off although the code can be easily adated to control other items.

Download the code for Lesson 5b

Technical explanation of the different types of toggle switches

Click image for larger versionLesson 5B Circuit Diagram

JQ8900 MP3 player resources

JQ8900 MP3 Player Arduino ESP32

nonRail resource page

nowRail pca9685 leds

Lesson 14 - External Interrupts part 1 - Rotary Encoder

How to set up and use External Interrupts with the Arduino UNO.

Part 2 deals with reading signals from devices and shows the basics of how to process the signals.

Download the code for Lesson 15

There is no circuit diagram for this lesson. However the following links may be useful.

Understanding FIFO buffers

DCC decoder circuit for Arduino UNO/ESP32

nonRail resource page

nowRail NCE Cab Bus

Lesson 12 - 28BYJ-48 ULN2003 Arduino UNO tutorial

Arduino UNO with ULN2003 and 28BYJ-48 Stepper motor tutorial using non blocking (State Machine) examples.


This is the first part of how to use a stepper motor in Arduino projects.
This lesson focuses on the basics of creating non blocking code.

Download the code for Lesson 12

Click image for larger version
Lesson 12 Circuit Diagram UNO and ULN2003 28BYJ-48 Stepper Motor

#99 ESP32mac address issues 08/06/2024

Lesson 1 Getting Started

In 2024 the ESP32 library was updated to version 3.0.0 (now at 3.0.1)

Although there are some obvious changes that break code such as the esp_now_register_recv_cb(OnDataRecv);

I discovered other issues that failed silently, setting a custom mac address is one of them.

This video shows how I set a custom mac address using ESP32 board library v3.0.1


Code Download New and old custom mac address code

#96 ESP-NOW Changes 03/06/2024

Lesson 1 Getting Started

In 2024 the ESP32 library was updated to version 3.0.0

This was much more than a bug fix and has changes that will break existing code. As I have discovered this includes ESP-NOW.
I first noticed this with the the line:

esp_now_register_recv_cb(OnDataRecv);

Producing the error:

Compilation error: invalid conversion from 'void (*)(const uint8_t*, const uint8_t*, int)' {aka 'void (*)(const unsigned char*, const unsigned char*, int)'} to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive]

This video shows how I fixed thse issues using the version 3.0.0 library.

Code Download Example receive and transmit code from the video

#89 Arduino C++ Arduino Starter Course

Lesson 1 Getting Started

#73 Arduino C++ nonRail introduction 15/05/2024

nowRail Introduction

Fifo buffers with buttons, sensors and interrupts. Also known as a ring buffer or circular buffer 29/04/2024

PCA9685 controlling multiple servos direction and speed with millis()

PCA9685 controlling multiple servos direction and speed with millis() 25/04/2024

PCA9685 controlling multiple servos direction and speed with millis()

Servo speed control with millis() 20/04/2024

ESP32 or Arduino DCC Accessory Decoder Circuit

ESP32 or Arduino DCC Accessory Decoder Circuit 03/04/2024

ESP32 or Arduino DCC Accessory Decoder Circuit

map() function 19/03/2024

map() function

CD4021B Shift Register 11/03/2024

PCA9685 servos controlled by buttons

#70 ESP-NOW Broadcast Mode 06/03/2024

PCA9685 servos controlled by buttons

#69 Fail Safe project planning 21/02/2024

PCA9685 servos controlled by buttons

Windows 11 CH340 driver problems Solved 10/02/2024

DY-SV5W MP3 Player

Fixing a Slow IDE 10/02/2024

Fixing Slow Arduino IDE

DY-SV5W MP3 Player
ESP32 Dev Module and ESP8266 D1 mini
09/02/2024

DY-SV5W MP3 Player

#62 DCC decoder controlling servos and LED's 23/01/2024

PCA9685 servos controlled by buttons

#60 Arduino Connectors and Plugs 15/01/2024

PCA9685 servos controlled by buttons

#59 Arduino Project Wiring 13/01/2024

PCA9685 servos controlled by buttons

#58 Model railway crossing with Servo Barriers, LED lighting and sound 08/01/2024

PCA9685 servos controlled by buttons

Multiple PCA9685 PWM Servo Boards with servos and LED's 05/01/2024

Multiple PCA9685 Servo driver circuit

DY-SV5W MP3 Player 15/12/2023

DY-SV5W MP3 Player

DFmini player & MP3-TF-16P v3.0 Player 21/12/2022

PCA9685

Arduino UNO and ESP32 controlling LED's with PCA9685 05/05/2022

PCA9685

Comments

Why is this site called Digital Town?
I owned the domain name so it seemed a waste not to use it.


If you have any projects you would like videos on please email the address in this image: and use Welcome to Digital Town as a reference.