Introduction: Z-light (alpha)

Hi, night bicycle trails are pretty popular in my country. I thought it would be cool if you have, beside of primary light, light which direction you can control with joystick. As I am a fan of MTB my requirements were: reliability, so you can use it in moderate terrain, low price and simplicity so everybody can make it. This is first version of Z-light I would call it alfa, its not field tested yet, but I believe it can make a regular trip. To make it, you will have to: 3D print parts, solder, crimp dupont connectors and program arduino nano (copy paste). If you never did this stuff before, don't worry it is all basics and youtube is filled with great tutorials.

Step 1:

Step 2: Parts and Tools

Parts list:

Not everything is on the picture.

About the screws, you can use any screw you will find home and consider them good enough.

Most of these screws I had from 3D printer kit.

1x Generic Arduino joystick or Sony PSP 2000 joystick (Amazon or Aliexpress)

1x Metal gear servo 54.1 x 20 x 44.3 mm (Amazon or Aliexpress).

I recommend to buy 20kg servo ( 20USD on amazon), it has much better movement and feeling than cheapest generic servo.

1x 9g servo (Amazon or Aliexpress)

1x Arduino nano (www.arduino.cc)

2x M5 wing nut, (Home depot, local hardware store)

2x M5 x 25 mm hex screw, (Home depot, local hardware store)

2x Hex nut for M5 screw, (Home depot, local hardware store)

4x Axial ball bearing F8-16M (8x16x5mm) (Amazon or Aliexpress)

1x Aluminium servo arm horn 24T (Amazon or Aliexpress)

2x M6 x30 Hex screw, (Home depot, local hardware store)

2x M2 x 6 mm screw, wood like thread (one usually come with 9g servo, Aliexpress)

4x M3 x 8 mm screw, wood like thread (in picture is 2x that is it a mistake, you can use two screws that come with 9g servo, I bought these in Home Depot)

4x M3 x 6 mm screw for standard arduino joystick

2x M3NS nut, (They come with 3D printer kits, Aliexpress)

3x M3 x 10 mm screw,(they come with 3d printer kits, Aliexpress)

1x Chicago screw 5 x 40 mm (Home depot, Amazon)

1x Mini led flash light (Amazon or Aliexpress)

1x Copper board 35 x 25 mm one sided for PCB (you might need spare, local store with electronics, Amazon.)

3x 14500 rechargeable batteries and charger (they are same shape as AA 1,5V batteries but these are different)

1x 14500 battery case for 2 batteries. Use different type or number of batteries or case if you want 18650 are even better. USB power bank with combination of 20 kg servo didint work for me.

2x Calbe tie

1x Dupont female - female 4 wire cable 20 cm long. You might crimp it. They come with arduino kits.

Dipont pins 2.54mm header curved, straight (comes with dupont crimping kit, aliexpres)

Spare wire

Nylon spiral wrap, 30 cm should be enough or textile sleeve

Copper etchant (local store with electronics, Amazon.)

Piece of anti slip mat - for handle to not slip

Velcro

3D printed parts

Tools list

Soldering gun

Dupont Crimping Pliers with Dupont connectors kit (I bought mine on Amazon for 40 CAD) - optional

Glue gun

Multimeter

Drill with 1mm drill bit

Allan key set and basic tools

Step 3: Preparing PCB

First you need to prepare PCB, I have been inspired by tutorial on youtube made by Gareth Burrows.

You need: 35 x 25 mm one sided copper board, etchant, fancy polish nail remover and laser printer.

I used glossy gift wrapping paper.

Print the scheme on the glossy paper.

Cut the scheme out and put it on copper board.

Apply pressure on paper and pout little bit of polish nail remover.

Continue to apply perpendicular pressure on every part of paper, until scheme shows up on the top of paper. Repeat several times and remove paper until its still wet.

Double check if the scheme is correct. If it didn't come out good, you can fix it with permanent marker.

Etch the boar.

After etching, make sure you don't have shorted circuit. Check with voltmeter + and - and the signals.

Short circuit will destroy your arduino board.

Drill all holes for pins with 1mm drill bit.

Step 4: Prepare Arduino Board

Solder PCB to arduino board, using straight pins.

I cut out half of the plastic part from pins so whole assembly takes less space.

Soldier PCB to arduino according to pictures and check again for short circuit.

Take 90 degree pins, you will need 2 x 6 pins, keep them together for easier manipulation.

Solder pins to PCB according to pictures.

Now it is good time to connect joystick and servos and try it (check connections in next steps). Also you can position servos to the middle of rotation.

IMPORTATNT:

Previously soldered pins will be in your way and you have to cut them so they wont stick out so much.

Insert servo connectors in pins and solder them with connectors.

Later you wont have a problem to insert connectors.

This was the hardest part of the project, at least for me.

Step 5: Prepare PSP 2000 Joystick (OPTIONAL)

If you want to use small joystick from PSP 2000, use 3D printed PSP 2000 joystick holder and follow this step.

Turn joystick up side down and with dupond pins mark holes.

Carefully drill the holes and solder 90 degrees pins to joystick.

In the picture I am using straight pins, they can be used but it is better to use 90 degree pins so you will have more room for velcro.

Check for short circuit between pins and use a glue gun (or try something else) to secure connector. This joystick is really fragile. I bought two of them and second one worked correctly.

Vise I am using is 2inch Desktop Vise by mdkendall on Thinkiverse.

Step 6: Prepare Joystick

You will need 4x M3 x 6 mm screw, 3D printed joystick holder and Dupont female - female 4 wire cable 20 cm long.

Assemble it together. You can protect connector with glue gun and glue female dupond connector to joystick 3D printed part. Later you can have issues with unplugging.

Also joystick is all naked, its not ideal for rainy and dusty environment (same for PSP2000 joystick).

Step 7: Prepare Servos

Now you need to shorten servo cables.

Cut wires and crimp new dupont connector or use other way.

In case you want to crimp dupont, I am attaching some pictures, MagoArcade on youtube made good tutorial.

Small servo cable should have 155 mm (6 1/8inch) including connector.

Big servo cable should have 115 mm (4 9/16 inch) including connector.


Find middle rotation position on big servo and put red servo arm on it, same as it is on picture.

Tighten the screws with allen key.

Small servo gear:

Take a 3D printer gear, super glue and small servo.

Dry try to fit gear on servo. It should be tight, probably you will need to clean a hole little bit.

Put little bit super glue into gear hole and put it on servo. Let it rest for hour.

IMPORTANT:

Gear have to be straight, not crooked, check it from more angles (see pictures).

Gear cant touch the servo, if the hole is big and gear is touching the servo, use some spacer when gluing (paper, thin cables). Otherwise it can stick onto the servo body.

Ones you will glue gear on servo you cannot remove it.

Step 8: Adruino Code and Scheme

As per first picture, connections goes from left to right:

  1. GND - black (big servo)
  2. +5V - red (big servo)
  3. Signal D3 - white (big servo)
  4. GND - brown (small servo)
  5. +5V - red (small servo)
  6. Signal D4 - yellow (small servo)
  7. +5V power supply (7V) - red (power supply)
  8. GND - brown (power supply)
  9. Analog input signal A6 - purple (joystick)
  10. GND - grey (joystick)
  11. Analog input signal A4 - white (joystick)
  12. +5V - black (joystick)

While connecting servos and power supply is obvious, joystick X and Y might be different.

I recommend to assemble all electronics and try movement directions (at this point you should have everything but power supply). Also the case if you left handed, left and right will be opposite. You can change the code or just twist joystick.


Second scheme picture is informative, inputs and outputs signals doesn't match.

Arduino upload code tutorial:

https://www.arduino.cc/en/main/howto


There are two code options.

First code keep returning original positions of servos.

With second code servos stay in set positions.

First line in both codes is #include

First code by:

Servos are returning to original positions

Code by biomech75 on instructables.com


Second code

Servos stay in position.

Code by Ali Hamza on maker.pro

I have a problem with this code since I didn't figure out how to change servo direction. One servo goes opposite direction. If you can help me with this and share it would be awesome.

Step 9: Final Preparations

IMPORTANT:

Batteries 14500 look similar to AA but they have 3,7V instead of 1,5V.

Do not use them where AA supposed to be. There is a physical protection, probably it won't work.

Prepare battery case 2 x 1450 batteries.

After modification you can use 2xAA battery case (I dont recommend this).

Crimp 2 x female dupont connector, length is not really matter is up to you where you will store power.

About 10 cm should be enough to store batteries in the bag in front of the bicycle.

You will connect it to another cable going from arduino board.

3D printed parts:

Thinkiverse

Pinshape

Step 10: Assembly

You can see the final assembly on the video.

There are few changes.

It is better to put board in with USB connector on right side.

With dupont pins directing to the top. its better because you are not able accidentally unplug joystick and power.

Take a time to put whole assembly and cables in.

In the end you can use textile sleeve or nylon cable wrap to protect wires.

In the next step I am planning to make headlight holder and gopro holder.

Headlight is lighter and in general have a stronger light than this flash light, also load on servos will be smaller.

If you have better ideas for mechanical and electronical designs and solutions, please share.

Thank you for your interest in Z-light.