Star Tracker Using Leonardo and Brain Shield

Hi Everybody,

Im new here - and new to Arduino and code!
I do astrophotography and was researching making a star tracker for my camera. It would be so satisfying to build one and programme it, instead of just paying several hundred pounds for a ready made one.
After looking around the net for ideas I came across a website called JJRobots that has a simple design with 3D printer plans for components and some fairly straightforward instructions.
They listed links to purchase the circuit boards required to drive the stepper motor, and I duly bought them.
However when they arrived I noticed that the 'brain shield' that they had listed as part of the design is not in fact the same board they have written the code for, the code is actually written for a set up using a JJROBOTS arDusplay Stepper Motor Control board which isn't available anywhere!
I have emailed and messaged JJRobots but so far there has been no reply.
So instead of just giving up and forgetting about the problem, I really want to get the tracker up and running if possible...
I know I'm new but Im reaching out to the community to see if anyone will help me succeed!
The set up is: Nema17 stepper motor - A4988 Driver - JJRobots Arduino Brain Shield - Arduino Leonardo

Link to Brain Shield:

Link to code:

I was wondering if the code could be altered to accomodate the brain shield instead of the shield which isnt available, or is a new code required...

anyway if anybody out there can help I would be very grateful!

Thanks
Lewis

A4988 driver modules can be had for about a dollar. That is all you need to drive the stepper. It could be that the the reason why the "brain shield" cannot be found anywhere is the people have woken up to the fact that it is inappropriate, overpriced, and redundant. If you want to use WiFi, you can use a Node-MCU instead, or simply add an ESPxx to Leonardo.

Nema17 stepper motor

"NEMA 17" reveals the size of the motor mounting plate, nothing more. Post a link to the important motor details.

jremington:
“NEMA 17” reveals the size of the motor mounting plate, nothing more. Post a link to the important motor details.

OK no problem here’s the information from the motor:

Nema 17 Bipolar 40Ncm 12V 0.4A Stepper Motor 42x42x40mm Reprap CNC Arduino

Thanks

Nick_Pyner:
A4988 driver modules can be had for about a dollar. That is all you need to drive the stepper. It could be that the the reason why the "brain shield" cannot be found anywhere is the people have woken up to the fact that it is inappropriate, overpriced, and redundant. If you want to use WiFi, you can use a Node-MCU instead, or simply add an ESPxx to Leonardo.

I have two A4988 drivers, and various other components including a perma proto breadboard. I'm very frustrated at JJRobots selling the incorrect hardware and then not responding to my communication.

a shield is often a thing that can be installed on top of a board like an UNO

the brain board appears to have an ESP8266 to allow one to use cell phones and such.
it also looks like it has a place for the A4988 drivers to sit.

In just the simple page in the link, it looks more like a driver board for the steppers.
separate power input, mounts for the drivers, output for the motors, sits on an UNO and has an ESP8266 that may or may not be able to replace the UNO for control.

based on the concept of the ESP8266, you need to find out what pins that uses to talk to an Arduino

then find out what pins the two A4988 boards use.

from there, it should just plug into an UNO and Bob's your Uncle.

The sketch on their Github page might be be usable.

the odd thing is that on the telescope page the controller and driver board are for one MINI and one A4988

if you want longer exposures, there is an advanced barn-door tracker design. but using steppers should allow you to get really good photos with this design.

on the surface, this brain board looks like it is nothing more than an interface that holds the drivers and offers a place to ie in an external power supply (ABSOLUTELY REQUIRED for steppers) and ties in an ESP8266 so you do not have a jumble of wires.

it is a shame there is no schematic on-line. did you get any support files or links or schematics of the board ?

how good are your photography skills ?
can you post a photo to each side of the board so we can see the copper traces ?

Generally speaking there is a lot of work in the design and if the files for making the gears is free that would make this a decent project. and in the end, one you should be happy with.

MECHANICS :
the rod you buy may be rough and have burrs from the threading process.
if you have a way to clamp a drill on a bench and then spin the rod,
take a tiny triangle file and 'chase' the threads once to remove burrs.
take a rag and with your thumbnail, press the rag into the thread and chase the rag. OK to have oil on it.
the rag should follow the threads easily down the length of the rod.
if the rag catches , find where, and with a file, smooth out the high spots.
as a note, the outer part of the thread can be filed to remove the knife edges that bit is not really used.
Also, the web page shows a single nut. a rod coupling nut would offer a much longer thread and may offer a bit more stability.

the idea behind this is that one lump of metal can cause the whole thing to jump as the lump enters or exits the nut.

as is noted, the longest duration of a photo should be less than 5 minutes due to the design of the barn door mount.
not sure why they limit to that point, but it may be that the sketch (software program) is crude and does not account for the angular shifting of the mount due to the single point hinge.

once you get this working, and if you want longer exposures, you can modify the sketch to alter the speed in order to account for the changing angles.

trig : your right angle is the base and the rod. your hypotenuse is the hinged barn door.
with side A as your base, you base is fixed by your construction.
side B is your threaded rod and as by the design, it alters length.
side H will alter length as side B changes.
this means that the angular rotation is not constant, but varies as the lengths of the sides change.
photos of up to about 20 minutes should be acceptable, and under 5 should be very good.
but it is only some programming to alter the speed of rotation.

and, your angular rotation shift with normal operation will be dwarfed by lumps of metal in your screw.

Thanks for the replies, here’s photos of the board in question. I think the attraction of the design was the ‘plug n play’ aspect of it rather than doing a lot of soldering - which I’m not averse to though, just seemed less margin for error.
I suppose my main aim would be to utilise the components I have (brain shield, driver, leonardo) and try to make a code for that. I have a 12v power supply (8XAA batteries plugged into the leonardo)
I’m building this on a tug boat so I have a full workshop at my disposal so have no problems with the actual building of the thing, it’s just the electronics and coding where I fall down. I’ll make sure the rod has no burs and runs smooth.

Back of the board

looking at the photos, it is hard to be positive, but looks like RX and TX for the Arduino and the EXP8266 are the pins used to communicate.

looks like step and dir are on 7/8/9 and 12.
you should be able to text with a meter
check the driver pins and verify the direction and pulse signal pins.

this is looking good for a shield to drive two steppers.

TuggyLewis:
t. I have a 12v power supply (8XAA batteries plugged into the leonardo)

are the batteries for a flashlight to help you find the power cord for the stepper ?
Not sure how larger that stepper is, or what size it is, but I am thinking that 8 AA batteries is about right to run a stepper for about 5 minutes.
Stepper motors are really notorious for sucking power.

Its a 12v 0.4a stepper, I only used the batteries as it needs to be portable, up mountains, on beaches etc, I would be grateful for any suggestions that would solve that issue.
I'll check the pins out with a multimeter, thanks for the guidance on that.
Once Ive got it correctly fitted together, would it be 'relatively' easy to alter the code to suit the new design?
Again, thanks for your help.

If you look at the jjrobots.com link that TuggyLewis has linked to in the original post, then towards the bottom of the page is a picture of the PCB with two optional stepper motor drivers fitted.

The sketch linked to is expecting a single stepper motor driver with the connections as follows:
together with 3 push buttons connected to pins D4, D5 and D6.

// STEPPER DRIVER CONNECTED TO:
// ENABLE pin: D10   (PB6)
// DIR pin:  D9      (PB5) 
// STEP pin: D8      (PB4)
// Button1 : START/STOP  D4
// Button2 : DEC   D5
// Button3 : CHANGE ROTATION DIRECTION (go back to original position)  D6

Indeed, the problem is that he has picked the board, as it said, already and can’t get the code for it. I’m sure the code for the single stepper can be readily adapted for the bigger board, it is probably just a matter of sorting out the pins that the stepper driver uses, and adding some buttons. The drivers are surely nothing special, they look the same as mine, and are used on both. Since the bigger board has WiFi, there must be a strong incentive to use that for control and dispense with the buttons.

JohnLincoln:
The sketch linked to is expecting a single stepper motor driver with the connections as follows:
together with 3 push buttons connected to pins D4, D5 and D6.

// STEPPER DRIVER CONNECTED TO:

// ENABLE pin: D10   (PB6)
// DIR pin:  D9      (PB5)
// STEP pin: D8      (PB4)
// Button1 : START/STOP  D4
// Button2 : DEC   D5
// Button3 : CHANGE ROTATION DIRECTION (go back to original position)  D6

looks like the ESP8266 can do it all !

dave-in-nj:
looks like the ESP8266 can do it all

Indeed it might. I don't know if the ESP8266 on that board has enough i/o pins. Since it appears to be a shield on a Uno, I assumed the Uno isn't entirely redundanr(!)

I think thats the main question for me really, whether my hardware can be used with a modified code - and yes, using wifi would be a great option if possible.

Nick_Pyner:
Indeed it might. I don’t know if the ESP8266 on that board has enough i/o pins. Since it appears to be a shield on a Uno, I assumed the Uno isn’t entirely redundanr(!)

My set up is with an arduino leonardo instead of an uno but it fits onto the shield.

The shield, driver and Leonardo all fit together exactly as shown in the photo on the website

TuggyLewis,
the brain board shield is a combination of
headers on which your A4988 can be placed
power in
motor power out
on-board ESP8266
connections for an UNO/LEONARDO

what the A4988 board need is a control signal to run. the A4988 needs two pins connected to a controller, one for step, one for direction.

in your case, you use direction rarely, but you output a steady pulse stream.

the on-board ESP8266 seems perfectly able to send the pulse stream making the UNO / Leonardo redundant.

or, the UNO / Leonardo makes the ESP8266 redundant for control, but adds wifi.

my suggestion would be to:
-upload the sketch to the ESP8266,
-plug in the A4988, plug in a motor, connect the power
-test the unit.

without anything connected to the stepper, you can send it 1,000 pulses, stop, reverse, send it 1,000 pulses, and repeat

this would prove your unit can work to driver a stepper, can work with that power supply, can work with the ESP8266.

since the ESP8266 is able to be programmed with the same Arduino IDE, it is as simple as plugging it in, selecting the device from your IDE and uploading the MODIFIED sketch.

Right, that's my plan for tonight then.
Why would jj robots design a build that incorporates both the Leonardo and the shield if either one is capable on its own?