Star Tracker Using Leonardo and Brain Shield

It seems the jjrobots site is old and not current.
the star tracker page shows a simple Leonardo board in a MINI configuration, with an A4988 attatched.
it then has a link to the sketch in gitHub.
GitHhub says the sketch is for that " adDusplay" board, but going to that page, shows the asDusplay, but when clicked, it takes you to the brainboard. I assume they only make the brain board.

[pre]// STARTRACKER MOTOR CONTROL: STEPPER MOTOR CONTROL FOR JJROBOTS POV DISPLAY
// This code is designed for JJROBOTS arDusplay Stepper Motor Control board
// Author: JJROBOTS.COM (Jose Julio & Juan Pedro)
// Licence: GNU GPL
// Stepper : NEMA17
// Driver : A4988 or DRV8825
// Microstepping : configured to 1/16
// Arduino board: Pro micro (leonardo equivalent)

// 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

[/code]

TuggyLewis:
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?

when the ESP8266 first came out, it was a way to connect an Arduino to a Wifi. a lot of work was done with the ESP8266 as an add-on board.
the ESP8266 only has 1 analog pin, the Leonardo has many more
the ESP8266 is 3.3 volts, the Arduino is 5v
the ESP8266 has 10 digital I/O pins, plus TX and RX that can be used as digital pins in some cases.
so, they are not equalivent, but complmentary.
you have the pins from the sketch, trace them from the ESP8266 to the A4988 to see which unit pulse or direction pin connects to which pins on the ESP8266. the sketch lists D10, so I would start with that and figure out what pins D10 connects to.
what is needed is to create a schematic of that brain board to figure out what connects to what.
if the ESP8266 connects to a level shifter, then you would need to verify how that is being used.
if the ESP8266 is only there to monitor, then it may need to be altered to run a stepper.
the key is to figure out the pin connections to know what connects to what.
I would double check your box to see if there was a schematic, or if there was a link in the order e-mail, etc.

Unfortunately no schematics to be found anywhere. I'll have a go at tracing what pins are what. I take it it's just then a matter of altering the code.
I take it I can hook my 12v supply up to the appropriate vin pins on the shield?

dave-in-nj:
what is needed is to create a schematic of that brain board to figure out what connects to what.

I managed to find a schematic of the brain shield, it wont let me upload .brd files on here so it has to be screenshots unfortunately. However if you have a JJRobots account you can find the .rar to download here (the .brd file is the one concerning the brain shield)
http://forums.jjrobots.com/thread-1179.html

Just want to say thanks to everyone for their help especially as I’m a total noob with all this and have never posted on here before!

Well, it should be all you need to make conversions to the code - if any. Everything is labelled and traceable.

And a revelation to me. I was going to say you can always ditch the board and, if you really need a shield, there must be a swag of Uno stepper shields around with accompanying documentation, but that JJ shield is unique to your Leonardo.

Of particular note is the dearth of connections to the ESPxx, implying it is just a simple WiFi add-on. There is plenty of discussion about adding them to Arduino, and you should be able to replace the buttons quite easily. Indeed the WiFi is the real value of this board.

Re your reply#19, that ESP is probably not capable of working alone because of insufficient i/o. I was originally alluding to the Node-MCU which has a lot more, but still only one analogue pin.

Ok so Ive hooked everything up, (power source - leonardo - brain shield - a4988 driver - stepper motor)
I’m trying to modify the original code to suit the new set up, as far as I can tell the leonardo fits onto the shield the same way as it did on the board the code was written for (same pin numbers etc.) the only difference being that the old board had three buttons, two of which were assigned to motor enable and motor direction.
My shield only has one button and looking at the schematics it appears to be wired to the A3 pin.
I tried to modify the code so that pin A3 reads low to start the motor and high to stop it, the code compiles and uploads to the leonardo but so far Ive had no success in getting the motor to turn!
Any opinions on the code are welcome!
Attached are the codes - code original is, well the original and code modified is my attempt at modifying it.

code original.txt (5.04 KB)

codemodified.txt (4.79 KB)