Saturday 23 June 2018

Tim's Cybot Arduino NANO Remote Control









This project is to create an Infrared Remote Control to control the Original Cybot received with the magazine Ultimate Real Robots, started back in 2001



At the moment it transmits the required codes to:

SONAR:
-AVOID FAST. Avoids objects at fast speed.
-AVOID SLOW. Avoids objects at slow speed.
-FOLLOW. Follows objects.
LIGHT:
-FOLLOW FAST. Follows light as fast speed.
-FOLLOW SLOW. Follows light as slow speed.
-AVOID FAST. Avoids light as fast speed.
-AVOID SLOW. Avoids light as slow speed.
LINE FOLLOW. Sets it in line follow mode.
REMOTE MODE. Using the 4 buttons, can control the direction of the motors.

Also there is the menu to set the channel.

I have tried to keep the menu system the same as the original Cybot Handset.

Reason for making the remote:(a little history)
Before the issue of the parts for the IR handset, Cybot was put into different modes by selecting DIP Switches. (There was no issue with Cybot while this was the case)
When the IR Handset was issued, things changed. A processor was upgraded to change the function of the DIP Switches. The DIP Switches where then used to set the channel used by the IR Handset so that more than one Cybot could be used together at the same time. (Up to 16 Cybot could be controlled with the Infrared Controls )
However, when the Infrared-Download-Board was issued, there where problems. Not all the boards where manufactured the same, there where issues that made some not work correctly or not work at all. There was a fix issued but this did not fix all.
I was one of the unlucky ones, nothing worked for me from there on, everything relied on the Infrared Handset working.

If you, like me, was one of the unlucky ones that had the same problem, you may wish to dig out your old box of Cybot bits and make this Infrared Controller to control it.

Lets Start.

First the prototype.

Before making the handset I built a prototype to test thing out and make sure my code worked.

Breadboard View
The Circuit

R8 and R9 are pullup resistors for the I2C bus. a lot of people forget to add these to the circuit, but they are required. (one pair per bus, not device)
As a rule of thumb to the resistors are added to the master, but as the Arduino could be used as master or slave and to keep things simple, internal pull are not used in the library.

I have used Internal Pullup Resistors for the Pins connected to the switches. So all Switches are to close to Ground.

The Resistor / Capacitor Pairs R1 to R7, C1 to C7 are to compensate for bounce. (so are not necessary if you want to do a quick test, I recommend them for stability)

Q1 is the driver for the Infrared LED (940nm). This is so full power is used by the LED to transmit the signals. (again if testing next to your Cybot, Q1, C8 and R11 can be removed. Connecting R10 and LED1 in series between Pin D3 and 5v should work)

I created the circuit using Fritzing, so here is the file so you can view it better: Arduino_Handset.zip

After making the prototype from the circuit above you will need to upload my HEX file to the Arduino NANO.

I use this uploader to do this: XLoader.

I have done a HEX file for the NANO and the UNO. (as far as I know they are both the same)
Arrduino NANO: Tims_Cybot_Transmitter_Nano_Atmaga328P_Internal_Pullup.hex
Arrduino UNO: Tims_Cybot_Transmitter_Genuino_Uno_Internal_Pullup.hex

For the Built version I use External Pullup Resistors.
Arrduino NANO: Tims_Cybot_Transmitter_Nano_Atmaga328P.hex Using External Pullup Resistors.
Arduino UNO: Tims_Cybot_Transmitter_Genuino_Uno.hex Using External Pullup Resistors.
(I don't know if HEX Files have the bootloader in them, but I did these HEX Files with it configured to Old Bootloader for the NANO)

XLoader is an easy program to use, you don't need to install it, it is a standalone program that runs from wherever yo put it. You tell it where the file is and tell it where to send it.(the port your NANO is plugged into)

As the Arduino NANO does not have a Voice/Sound processor It will not be able to do those related commands.


Next step is to make a functional usable Handset.


Rather than make one circuit board and mount everything to the one board, I have decided to make this project modular.

By making it modular, some modules may be found on the internet.

List of Components / Modules:


Arduino NANO

The chip needs to be ATmega328 (If you are using China Clones)
This program uses 90% of both SRAM and EEPROM

OLED

Mono (Black and White)
0.96 inch
128 x 64 pixels
I2C connection

Rotary Switch with Push Button

I made this board my self.
I wanted external pullup resistors and de-bounce on all switches.
Some rotary switch modules can be found on the internet.(be sure they have pullup resistors on the board)

It can be made on a Perfboard.

Here is a Fritzing file: Tims_Rotary_Switch.zip
(Obviously the wires go under the board)

Infrared Transmitter

I made this board my self.
There are some modules on the internet, but be sure to get one that has a driver. (has a transistor to power the IR LED from the power supply)

It can be made on a Perfboard.

Here is a Fritzing file: Tims_Infrared_Transmitter.zip
(Obviously the wires go under the board)

Control Buttons

Luckily I had a 4 button panel I removed from an old Epson printer.
This panel has pullup resistors and de-bounce components fitted to it.
But not every one has a box full of old bits to use, so here is the circuit.

It can be made on a Perfboard.

Here is a Fritzing file: 4_buttons_with_Debounce_and_Pullup.zip
(Obviously the wires go under the board Apart from one)
A Note on making it on a Perf-Board, the top and bottom fits into plastic parts I made on my 3D Printer.

The size of the board should be 65mm X 40mm.

When fitting the plug to the cable, note that the pins are as follows:
Left Forward = pin D7
Left Reverse = pin D8
Right Forward = pin D6
Right Reverse = pin D9

Power and I2C Bus-Board

To make things easy to connect all the components together I have made a Bus-Board for the power and I2C.
Putting the I2C bus on the board with the power makes it easy to add the 2 Pullup Resistors required for the I2C Bus.
(As I have only one I2C component, I only needed to fit 2 headers on that bus)

It can be made on a Stripboard.

Here is a Fritzing file: I2C_Bus.zip

To connect all the components together a few cables need making.






3D printed parts.

Base
STL File: Base.stl

Switch Side
STL File: Switch Side.stl

NANO Side
STL File: NANO Side.stl

Battery Clip
STL File: Battery Clip.stl

NANO Clip
STL File: NANO Clip.stl Also need to make a mirrored copy

Encoder Nut
STL File: M7 Tophat Nut.stl

Encoder Knob
STL File: Knob.stl

Button PCB Support
STL File: Button Support.stl 2 are required

OLED Support
STL File: OLED Support.stl

Assembly

The first parts to fit are:
The Switch to the Switch Side. (2 x small screws)
Infrared Transmitter Module to the Base. (2 x M3x10 flat end self tappers)
Power and I2C Bus-Board to the Base. (2 x M3x10 flat end self tappers)
Rotary Switch Module to the Base. (M7 Nut)
Place Battery with Battery Clip on Base.
Fit Switch Side to Base over the Battery Clip. (2 x M3x10 flat end self tappers)
Fit cables from the Switch to the Battery and the Arduino NANO.
The Cable to the Arduino NANO goes to the pins VIN and GND.

How the Assembly should look so far:


Before fitting the Arduino NANO to the base, it is a good time to fit some of the cables to the Arduino.
See picture above for cable lengths and ends.

Arduino to Power-Bus. The split connector end goes to pins 5V and opposite GND.
Arduino to I2C Bus. Connect to pins A4 and A5.
Arduino to Encoder Buttons. Connect to pins A0, A1 and A2.
Arduino to IR. Connect to pin D3.

How the Assembly should look so far:


Now the Arduino can be fitted in place. (lower cables need to be bent up )

Then:
Arduino to Power-Bus. Connect to pins on the Bus-Board, 5V to VCC, GND to GND.
Arduino to I2C Bus. Connect to pins on the Bus-Board, A4 to SDA, A5 to SCL.
Arduino to Encoder Buttons. Connect to Encoder Module.
Arduino to IR. Connect to Infrared Module.
Connect Power Bus to IR.
Connect Power Bus to Encoder Module.
Connect Power Bus to OLED. (just to the power bus at the moment)
Connect I2C Bus to OLED. (just to the I2C bus at the moment)

How the Assembly should look so far:




Next is to fit the NANO Side.

This has 2 NANO Clips attached (1 x M3x10 flat end self tapper in each)




Next is to fit the Button Board Supports to the Button Board.


Next is to connect the Button Board and the OLED

The cables for the Button Board go through the NANO Side Support.
Power Cable goes to the Power Bus.
The Button Cable connects as follows:
Left Forward = pin D7
Left Reverse = pin D8
Right Forward = pin D6
Right Reverse = pin D9
The OLED connects to the previously connected cables to the Bus Board.

Now the Button board and OLED Support can be fitted to the top. Also the Knob for the Rotary Encoder.
Finally fit the OLED to it's support. (2 x M2 self tapping screws)






Please comment if you like or make it.








I have a web site as well: Tim's Place



11 comments:

  1. What kind of 3D printer do you have?

    ReplyDelete
    Replies
    1. I have an Anet A8
      See my mods here: https://3dprintermods.blogspot.com/2017/08/tims-modifications-to-a8-3d-printer-i.html


      eBay: https://www.ebay.co.uk/sch/i.html?_odkw=%22a8+3d+printer%22&_sop=15&_osacat=0&_from=R40&_trksid=m570.l1313&_nkw=%22A8+3D+printer%22&_sacat=0

      Delete
  2. so happy to find good place to many here in the post, the writing is just great, thanks for the post. remote ssh

    ReplyDelete
    Replies
    1. Thanks for leaving a comment.
      Glad to see you do a Free service :)

      Delete

  3. hello, great job!
    would you share the code for arduino (.ino), actually i would like to translate to french (easier for kids).
    good continuation,

    ReplyDelete
    Replies
    1. Thanks for leaving a comment.
      Actually, this original code I did, no longer compiles, code to big. Arduino API updated a library and I didn't make a note of which one I used. (it was a modified one, but with the same name as another.)
      Had to do a new one with different library for the screen, 128 x 64 pixels and Text for menus uses a lot of memory, so I added memory to my current version, this also abled me to make the animation larger.(I think I may have added more menu as well)
      I have put a lot of effort and time into this one, so I am only releasing it as HEX.
      The new version with the ATMEL 24C256 fitted, like I did in this project:
      https://tims-mini-plotter2.blogspot.com/2019/04/adding-memory-to-arduino-nano-and.html
      Has all the words used in the menu system.
      So changing the words on the ATMEL 24C256 should be doable. (They can be changed to whatever you wan to use. In theory.)
      Would you like to try a copy of the new HEX and add memory?

      Delete

    2. thanks for your reply, i understand you don't want to share the code, that's okay.
      I'm ok to test your new HEX, with added memory, again thank you for your time.

      Delete
    3. If you can manage with the current version for now.
      I don't have time to write up the new addition at the moment.
      There are some other stuff I want to get done first.
      I will keep in mind changing languages when I get around to it.

      Delete

    4. yes I understand, I also have a lot of projects in progress ....,
      I would have tried to make my own remote control but as I have no information on the IR protocol of cybot and tom it is not easy .....
      Thank you again and good luck

      Delete
  4. Hello Tim,
    Can I change Atmel 24C256 by 24C512, because it stores more data? In adddition, if I want to build the bigger machine, can I change stepper of DVD by stepper motor nema 17?

    ReplyDelete
    Replies
    1. Both the 24C256 and 24C512 communicate via I2C (Two Wire Serial), so the only difference is the amount of memory.
      Changing the type of stepper motor may require you to change the stepper driver you are using, you need to check that the stepper driver can handle the load of the stepper motor.

      Delete