Are there any Apps to turn an Android smart phone into a Picaxe controller?

wapo54001

Senior Member
I enjoy doing macro photography. I'm building a focus stacking controller to drive the focus ring of my camera using a geared stepper, stepper driver board, and a Picaxe (probably a 20x2 and an 08m2 to include IR control) to handle the calculations and control the focus ring & shutter. The goal is to automate the process of taking multiple images at slightly different focus points between the nearest and farthest point of an image so that the entire image is in focus when the multiple images are stacked together to create a single entirely-in-focus image.

I would really like to use my smart phone to set the parameters with a USB-to-Serial cable and pads on the touch screen to set start/end points and a few other control requirements -- I think all I need is Up, Down, OK, Menu and Reset buttons, plus a portion of the screen to display text.

I have looked, I think, pretty much everywhere I can think of and find no program/app that provides a user-designable screen layout with USB output of control instructions. The only mention at the Picaxe forum seems to date back to 2010. I guess I could switch to Bluetooth if that was fairly easy to implement, never done that before.

My other alternative may be a Nextion screen.

Is anyone aware of an application that might work on my smart phone?
 

bpowell

Senior Member
I'd think Bluetooth is the way to go.

I'm sure there are appps out there for sending commands via Bluetooth ... I've made a remote control before to turn LEDs on and off .... I recall using a phone app. If I can remember the app name, I'll post it here.
 

kfjl

Member
Hi,
Why do you think you need a 08m2 for IR control? A 20x2 has enough pins to do it all.
What you want to do has already been done with a raspberrypi and a flat-bed scanner, but only for close-up stuff.
You don't need an "app" to be able to control things from a smart phone, just a web page.
I don't understand "USB output of control instructions". The "control instructions" are from the clicks on your web page. You don't need to be connected to a computer.

I haven't done much with Bluetooth. I'm curious to see what @bpowell has up his sleeve. Probably easier than what I have in mind. :)
 

wapo54001

Senior Member
Hi,
Why do you think you need a 08m2 for IR control? A 20x2 has enough pins to do it all.


Because ten years ago I designed the circuit and wrote the code to allow both IR control and a rotary encoder to work simultaneously on a 20X2 with 08M2 support, and a) I'm not good at this and b) haven't done anything with a Picaxe in many many years, and with those handicaps at age 79 I don't want to have to do it again.

What you want to do has already been done with a raspberrypi and a flat-bed scanner, but only for close-up stuff.

I plan to use a Picaxe not an RPI. If I wanted stacking by moving the camera for only small objects, I would use a proper linear rail with a stepper motor not a flatbed scanner. However, this is not just for macro focus stacking but for everything up to sweeping interlaced panoramas. I have already built the camera/motor framework and the toothed gear drive system from the stepper to lens ring; this system is intended to work on any range of focus from a few inches to infinity.

You don't need an "app" to be able to control things from a smart phone, just a web page. I don't understand "USB output of control instructions". The "control instructions" are from the clicks on your web page. You don't need to be connected to a computer.

Interesting, but not enough information for me to understand what you are saying, and I don't think I mentioned the use of a computer. It is intended to be completely self-contained, low-power, lightweight (as much as possible), and portable. All I wanted to know was if anyone knew of a smart phone app that permitted customizing a touch screen and outputting simple ASCII via USB cable.
 

wapo54001

Senior Member
Maybe something like this or this ❓(I've not tried either of them)
Phil, thanks for the suggestions.
The Bluetooth control looked good at first, but I realized that what I have in mind must keep track of steps at all times, plus make some simple calculations of steps between first and last exposure and number of steps between intermediate exposures, etc. The control must have some brains.
 

inglewoodpete

Senior Member
Bluetooth is an option. A few years ago I used Keuwlsoft's Bluetooth Electronics Application on an Android phone to configure my own bluetooth control "app". I see that the latest version of the app allows a USB serial connection to be used, rather than bluetooth.

You configure your "app" in your microcontroller. With the generic Keuwlsoft app loaded and running in your phone, the PICAXE or any mictrocontroller transmits the configuration to the mobile, which then places buttons, dials and gauges on the screen. You can then read values or tap on switch pads to tell you microcontroller what to do.

KeuwlSoft have a range of apps, all with user guides. Well worth any PICAXE enthusiast having a look!
 
Last edited:

wapo54001

Senior Member
Hi,

A nine year old post, but RoboRemo (Free/Demo) still appears to be available, but I have no experience of using it.

Cheers, Alan.
I think it's going to have to be a Picaxe with a two-line OLED display in order to show the steps as I go through a setup sequence before triggering the series of exposures, allowing a primitive menu system etc. When I was wondering about a smartphone I was envisioning two-way communication between the Picaxe and the phone with the phone being the touch screen and data display. All of the very few apps I've looked at are essentially one-way communication. Thanks all for the suggestions, they have helped me understand the underlying requirements more clearly.
 

inglewoodpete

Senior Member
When I was wondering about a smartphone I was envisioning two-way communication between the Picaxe and the phone with the phone being the touch screen and data display. All of the very few apps I've looked at are essentially one-way communication. Thanks all for the suggestions, they have helped me understand the underlying requirements more clearly.
The Keuwlsoft app that I mentioned can send commands by tapping on screen 'touchpads' and receive and display data from the remote microcontroller.
 

wapo54001

Senior Member
Pete, I woke up to your post, and this does look like it will do the job! In fact, the description looks pretty amazing. I will look at it more as soon as I have a moment. Thanks for bringing Keuwlsoft to my attention. It looks pretty amazing, hope it's true. :)
 

Bill.b

Senior Member
I use Bluetooth Electronics Application on my android phone combined with HC-06 receiver for my robot car.
This is part of the code used. Picaxe is a 40x2

Code:
RemoteIn:
REM Controlling car with BT module HC-06 - PICAXE
do
 'b12 = 0  ;clearing memory for commands
 serin [2000],a.0,T9600_16,b12,b13,b14,b15,b16 ;reading from bluetooth (waits 2s for character)
     pause 50
 'debug
 'select b12  ;selection depending on received character
select case b12
 case 65
    gosub FWDFast    'FWD
case 66
    gosub TurnRight    'FWD Right
case 67
    gosub TurnRightR    'REV Right
case 68
    gosub BackFast    'REV
case 69
    gosub TurnLeftR    'Rev Left
case 70
    gosub Turnleft    'FWD Left
case 71
    gosub stopm    'Stop
case 72
    VoiceNo = 33
    GOSUB voice    'camera on
case 73
    VoiceNo = 34
    GOSUB voice        'camera off

case 74
    Pwmduty M1PWM,900
        gosub TurnAround2
case 75
    Pwmduty M1PWM,900    
        gosub TurnAround
 case 113        'Speed
     b17= b14 -48
     if b15 = 10 then
         b18 = 0
          goto loopend
    else
        b18 = b15 -48
     endif
     if b16 = 10 then
         b19 = 0
    else
         b19 = b16 - 48
    endif
end select
loopend:
b7= b17 * 10 + b18 * 10 + b19 'Convert from ASCII to Binary
SpeedCount = b7 * 3 + 200        'Speed count for PWM = 200 to 950
Pwmduty M1PWM,speedCount
loop

return  ;end of loop
Bill
 

PieM

Senior Member
Last edited:

Buzby

Senior Member
I use B4A ( BASIC for Android ) to build apps that connect via Bluetooth. B4A is much like Visual Basic, so I felt at home with it. One of it's great features is that when you open a new project it is pre-populated with the skeleton of a typical app, so getting started is easy. Another goodie is the B4A-Bridge, which lets you use the target device for development. ( There is also an emulator, but that's a bit slow. ) Although B4A is easy to use, it is not a toy. It can be used to develop really compex apps with lots of 'moving parts'.
 

wapo54001

Senior Member
Having looked at the android app and the HC-06 bluetooth module, I think I can do this, using the Picaxe to do the calculations and store the variables, and the smart phone as display and touchscreen control. I think I can use my old 20X2 design and use hserin and hserout connected directly to the HC-06. In my original application the Picaxe could accept a continuous string of commands to do UP and DOWN for volume control using hserin driven by an 08M2 dedicated IR receiver. I hope I can just substitute the HC-06 for the 08M2 in that regard.

I do have some questions starting with this one:

The HC-06 transfers data at 3.3V, but requires 5.0V power.
The Big Easy Driver board has a power pin that can be either 3.3V or 5.0V out, with 85ma load.
The HC-06 requires 40ma, leaving 35ma for the Picaxe circuit.
So, a conundrum -- if I run all the boards at 3.3V from the BED board, I need a separate 5.0V supply for the HC-06. If I run the BED and Picaxe at 5.0V and supply the HC-06 with 5V as it requires, then how do I convert the 3.3V HC-06 output to drive the hserin expecting 5.0V? (I would use a voltage divider to handle the hserout to HC-06 mismatch.) There doesn't seem to be one solution that covers everything without adding another regulator to the mix.
Am I missing something?focus_stacking_5.jpg
 
Last edited:

AllyCat

Senior Member
Hi,
.... how do I convert the 3.3V HC-06 output to drive the hserin expecting 5.0V?
Indeed, the supply rail is not important as such, it is the Logic Level maximum "High Threshold" which is important. The PICs have "Quasi-TTL" inputs where even the maximum High Threshold is less than half of the supply rail, so the inteface would be fine, even allowing for a "noise margin". BUT .....

The HSERIN pin (B.6 = Leg 12) = PIC EUSART RX pin RB5 (PIC18F14K22 Data sheet page 11) is a "ST" (Schmitt Trigger) input which is specified with a maximum High Input threshold of 80% * VDD (parameter D041 page 334) or about 4 volts. :(

However, in practice, I believe the ST inputs have a hysteresis of only a few hundred millivolts and the maximum "Low Level" threshold = VDD * 20% (parameter D037 page 334) is only slightly higher than a TTL input (VDD * 15%), so in reality I think a 3.3v to 5.0 VDD interface will work perfectly well. ;)

IMHO it's rather like the FVR (voltage reference) or the Watchdog (Sleep) Timer which have specified tolerances perhaps ten times worse than their "real world" encountered values. But if you are really worried, you could just add a weak pullup resistor (perhaps 100k) from the RX pin to the 5 volt rail. Many "3.3 volt" I/O pins are either "5 volt tolerant" or have an "electrostatic protection" diode to the supply rail which will limit the voltage to a safe level for the chip (i.e. approximately 4 volts).

Cheers, Alan.
 

AllyCat

Senior Member
Hi,

Maybe that's what the PICaxe data implies, but the 20X2 is a programmed Microchip PIC18F14K22, which on page 11 of the datasheet gives Leg12 (PICaxe B.6, PIC port B.5) as "TTL" (or TLL !) IF it is used as a Logical I/O pin, but it's a "ST" input IF it is used by the EUSART (Hardware) input (which it must be for the HSERIN command to work).

1720694519523.png

Cheers, Alan.
 

kfjl

Member
Whenever I have anything 3.3V tolerant to connect to a picaxe, I run the picaxe off 3.3V. It saves a converter and wiring.
It's always worked for me.
 

wapo54001

Senior Member
Thank you both, it sounds like you agree that it'll work, and that's good enough for me. I'll breadboard it and verify, but it sounds good. The HC-06 apparently is susceptible to damage from a 5V input, so I'll use a voltage divider on hserout and hopefully that's all it'll need. Parts I need arrive today. :p
 

wapo54001

Senior Member
Whenever I have anything 3.3V tolerant to connect to a picaxe, I run the picaxe off 3.3V. It saves a converter and wiring.
It's always worked for me.
That is what I was planning until I found that the HC-06 board requires 5V input to run 3.3V I/O. The BED board makes available up to 85ma of regulated 3.3V OR 5.0V and that is enough power provided I can run the entire circuit off of one voltage or the other. For the cost of two resistors I can avoid providing two voltages with a second regulator circuit (provided the current requirement stays within limits for the BED regulator).
 

AllyCat

Senior Member
Hi,
Whenever I have anything 3.3V tolerant to connect to a picaxe, I run the picaxe off 3.3V. It saves a converter and wiring. It's always worked for me.
Yes, it appears that all the chips above (except the PICaxe) are probably running on 3.3 volts, with the 5 volts just required to give some headroom for the regulators? So my inclination would be to use 3.3 volts also for the PICaxe: BUT.....

The "(optional) Keypad" shows buttons connected directly to 5 volts (?), so you should at least use a series resistor between the keypad and each PICaxe input. Direct connection (to a 3.3v powered PICaxe) would be definitely "dangerous" because it could "phantom power" the PICaxe rail up to about 4.3 volts, or might even destroy its protection diode(s).

More generally, although the PIcaxe has reduced input threshold levels (i.e. "TTL"), many CMOS integrated circuits will use standard CMOS thresholds, where the nominal value is VDD / 2, so the maximum "High" threshold might be higher than 3.3 volts if used with a 5 volt rail (and taking into account noise margins, etc.).

Cheers, Alan.
 

wapo54001

Senior Member
Hi,

The "(optional) Keypad" shows buttons connected directly to 5 volts (?), so you should at least use a series resistor between the keypad and each PICaxe input. Direct connection (to a 3.3v powered PICaxe) would be definitely "dangerous" because it could "phantom power" the PICaxe rail up to about 4.3 volts, or might even destroy its protection diode(s).

Cheers, Alan.
The schematic is a work in progress, the 'optional' display and keyboard were what I intended to do before I found the smart phone app. This new schematic is in line with what I plan now.

I suppose I need to ground all the unused pins. The 20X2 has more pins than I need, but I'm using it because of the background receive capability -- I think I need that to receive successive pulses from the smartphone to move the stepper continuously from one focal point to another when doing the setup.

focus_stacking_51.jpg
 
Top