Welcome, Guest. Please login or register.

Username: Password:

Author Topic: DIY PCB and Bluetooth support for Arduino version  (Read 12209 times)

GigiG

  • Full Member
  • ***
  • Posts: 28
    • View Profile
DIY PCB and Bluetooth support for Arduino version
« on: February 28, 2015, 15:43:24 »

Hi Tom, just finished my DIY AstroEQ Arduino version. I designed a dedicated PCB and stacked on top of a Mega2560. Two A4988 and a couple of RepRap NEMA17 to start testing. It works fine both in Windows (ASCOM-CdC) and Linux (INDI-KStars). 12V powered and USB or HC-06 Bluetooth serial communication. I wrote a page on this work, sorry it's only in italian at the moment but images and videos should be rather self explanatory ...
https://sites.google.com/site/gigimysite/home/astro/astroeq
Hope that can be usefull for someone to build their own.

P.S.: of course I mentioned your AstroEQ web pages and software availability on my site. I mentioned also that your software (Arduino firmware) is open source but I'm not sure about this. Please, tell me I have to change this note.
Gigi
Logged

MockTurtle

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #1 on: March 23, 2015, 13:24:06 »

nice work! just a question as I see you also have re-assigned the pins on the mega (for a neater layout i suppose) are there any guidelines on what pins are safe to reassign or best practices/recommendations?

I have a modified PinMappings.h file which on testing seemingly does not perform 100% - ie there is a 'lag' (sometimes) when pointing RA/DEC axes. Orig mapping works 100% though?

Also I would like to take this opportunity to thank you guys (especially Tom) for sharing your work with us. Have been contemplating a while now on an arduino solution for a scope mount, and have consequently stumbled on this site.
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #2 on: March 23, 2015, 13:48:10 »

Hi,

For the most part, it is safe to reassign everything but the 'step', 'ST4' and 'serial' pins. For the ST4 there are two locations which are allowed selected by a #define in the pin mappings. For the Step pins, these must stay where they are (less important in the more recent firmware, but better for if I decide to change the code later on). Serial could I support be used with one of the Mega's other UARTs, but that would require changing the serial code (I am using my own as the Arduino one is very inefficient).

The other thing to remember is that you are not allowed to use Digital Pins 30 to 37 inclusive for anything. Make sure these stay unconnected.

One thing to bare in mind is that if you use your own pin assignments, you will have to recompile the code whenever I release a new firmware update as your pin mappings will be different from mine.

Regards,
Tom.
Logged
Tom Carpenter (AstroEQ)

MockTurtle

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #3 on: March 23, 2015, 14:15:21 »

...by 'serial pins' I would assume you mean pins 1 and 0? also not sure what you mean by the two locations for the ST4? (basically pin 50-52 for the mega).

In any case thanks Tom, and duly noted!

Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #4 on: March 24, 2015, 02:47:47 »

For serial I do mean 1 and 0.

If you look on lines 56 to 66 of the PinMappings.h file, you'll see what I mean about two options for ST4. By default I use 50-53, but it is also possible to use A8-A11 (both sets have the same arrangement of pin change interrupts). The second set was added as there is one person that was customising the firmware for their project and wanted to add some extra code to control something with SPI - which on the Mega is 50-53.
Logged
Tom Carpenter (AstroEQ)

MockTurtle

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #5 on: March 24, 2015, 12:43:19 »

For serial I do mean 1 and 0.

If you look on lines 56 to 66 of the PinMappings.h file, you'll see what I mean about two options for ST4. By default I use 50-53, but it is also possible to use A8-A11 (both sets have the same arrangement of pin change interrupts). The second set was added as there is one person that was customising the firmware for their project and wanted to add some extra code to control something with SPI - which on the Mega is 50-53.

i guess you probably have a newer version of files as I don't see the A8-A11 option in lines 56-66... only mode pins (see github link below)? or maybe i'm just going mad?  :-[ :o  ;D

https://github.com/TCWORLD/AstroEQ/blob/master/AstroEQ-Firmware/PinMappings.h
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #6 on: March 24, 2015, 13:47:25 »

Ah, you're right, I must not have updated the files on the Github yet.
Logged
Tom Carpenter (AstroEQ)

velinoff

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #7 on: June 12, 2015, 01:19:54 »

Hello guys! I've managed to add HC-06 to my Arduino based AstroEQ. Everything(EQmod,CDC,PHD2,Astrotortilla) works very well under windows except 2 minor nuisances. 1. Can not use the upload utility (through the usb connection)while the bluetooth is connected. 2.You need an administrative privileges to access the port once the connection is established.   
The first one I have to investigate what will happen if I try to unpair. The second one is probably problem with the driver and/or windows 8.

Less than a month ago I've bought AstroEQ V4.4 from Tom, but I am so happy with my Bluetooth Arduino version that crossed my mind what will work if I squeeze in bluetooth module in the original box and connect it to R15 and R16?

Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #8 on: June 12, 2015, 05:34:12 »

I imagine configuration is not possible because the Bluetooth module will be driving the TX line high so the USB-Serial can't communicate, you'd physically have to disconnect the Bluetooth module to configure via USB or add some sensing circuit. Unfortunately configuration over Bluetooth would not be possible because of the lack of a DTR line needed to reset the chip.

In terms of the purchased AstroEQs, I am actually about to test a prototype Bluetooth module (just waiting for the PCBs to arrive). The AstroEQTooth would simply plug in to the AstroEQ in place of the PIC (USB-Serial chip). I've designed it with a surface mount PIC on it so that you can still use USB without having to take the module out. Plus when you plug in the USB cable it will detect that and automatically disconnect the Bluetooth module allowing control/configuration over USB. There is also an override switch so that the BT can be switched off if not needed to save power.
Logged
Tom Carpenter (AstroEQ)

doramason

  • Full Member
  • ***
  • Posts: 37
    • View Profile
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #9 on: September 05, 2017, 13:13:33 »

I imagine configuration is not possible because the Bluetooth module will be driving the TX line high so the USB-Serial can't communicate, you'd physically have to disconnect the Bluetooth module to configure via USB or add some sensing circuit. Unfortunately configuration over Bluetooth would not be possible because of the lack of a DTR line needed to reset the chip.

In terms of the purchased AstroEQs, I am actually about to test a prototype Bluetooth module (just waiting for the PCBs to arrive). The AstroEQTooth would simply plug in to the AstroEQ in place of the PIC (USB-Serial chip). I've designed it with a surface mount PIC on it so that you can still use USB without having to take the module out. Plus when you plug in the USB cable it will detect that and automatically disconnect the Bluetooth module allowing control/configuration over USB. There is also an override switch so that the BT can be switched off if not needed to save power.

Hi Tom,

I had the problem also with USB connection not working while HC-05 module is connected to my DIY Astroeq. Hence, I had disconnected it from the board and I have been using the USB cable ever since. But it has the bad habit of disconnecting once in a while in the middle of the night if I accidentally touch it so I prefer a cable-free solution that's why I'm back to bluetooth.

This sensing unit you have mentioned; do you have any schematics for it? Is it something easily can be added with the bluetooth adapter? Does it automatically cut the connection to the bluetooth module every time USB cable is connected?
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #10 on: October 01, 2017, 18:54:42 »

@Doramason

I never got a chance to get those modules working.

The easiest thing to do from a DIY standpoint is to look how people are using Bluetooth modules with Arduino boards as essentially all you need to do for comms is connect the Bluetooth module up to the UART port on the MCU instead of the USB-Serial IC. Depending on the module you'll also need some level shifting as the MCU runs at 5V and so won't reliably be able to talk to a 3.3V BT module without level shifting.

Logged
Tom Carpenter (AstroEQ)

doramason

  • Full Member
  • ***
  • Posts: 37
    • View Profile
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #11 on: October 01, 2017, 22:00:16 »

@Doramason

I never got a chance to get those modules working.

The easiest thing to do from a DIY standpoint is to look how people are using Bluetooth modules with Arduino boards as essentially all you need to do for comms is connect the Bluetooth module up to the UART port on the MCU instead of the USB-Serial IC. Depending on the module you'll also need some level shifting as the MCU runs at 5V and so won't reliably be able to talk to a 3.3V BT module without level shifting.

Yes I have done level shifting with resistors for the HC-05 module's RXD lead, that's how it is connected to Arduino. I'm attaching the schematic I have followed. As I have stated, when I do this with RXD,TXD on the Atmega IC, I can't use the USB connection at the same time while Bluetooth is connected. And config utility only works with USB. You have mentioned a sensing unit which can be used to connect USB while bluetooth module is still connected. Is it possible to add one to the Astroeq? Can you give a basic schematic? 
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #12 on: October 01, 2017, 22:09:50 »

True, but you only need to use the config utility (USB) when updating the firmware and changing the configuration. You don't need to use it in general running.

The easiest thing to do would be to put a SPDT switch on the RX line of the ATMega. You can use that to select whether the Bluetooth TX pin or the USB IC TX pin connects through to the ATMega.

I was trying to use the VDD line on the USB port to sense when it was connected and do the switchover electrically, but because of the structure of the GPIO pins of the USB-Serial IC (protection diodes), the VDD of the USB doesn't always drop to zero when disconnected - the TX line of the ATMega powers it through the protection diodes. There are solutions, but I haven't had time to investigate.
Logged
Tom Carpenter (AstroEQ)

doramason

  • Full Member
  • ***
  • Posts: 37
    • View Profile
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #13 on: October 02, 2017, 09:01:39 »

True, but you only need to use the config utility (USB) when updating the firmware and changing the configuration. You don't need to use it in general running.

The easiest thing to do would be to put a SPDT switch on the RX line of the ATMega. You can use that to select whether the Bluetooth TX pin or the USB IC TX pin connects through to the ATMega.

I was trying to use the VDD line on the USB port to sense when it was connected and do the switchover electrically, but because of the structure of the GPIO pins of the USB-Serial IC (protection diodes), the VDD of the USB doesn't always drop to zero when disconnected - the TX line of the ATMega powers it through the protection diodes. There are solutions, but I haven't had time to investigate.

I have also thought of putting a switch but it didn't seem very practical, there is no space left on the box so it has to be inside. So everytime I want to use USB I have to open the box which can be tricky in the dark.

So I'm guessing you won't be investigating anytime soon :(. Maybe it is possible to copy it from arduino boards? Because it is possible to use them with both USB and bluetooth without cutting connection.   
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: DIY PCB and Bluetooth support for Arduino version
« Reply #14 on: October 02, 2017, 11:23:52 »

Doesn't have to be a very big switch. Something like this would be very compact. Could mount it on the end panel beside or above the USB connector. Then route internally to the BT, USB IC, and ATMega.
Logged
Tom Carpenter (AstroEQ)