Cycle Analyst Beta 2.1 Experiments

Did anyone manage to get bluetooth working with the CA?

I'm a iPhone developer, so I could write an app if the bluetooth works on the CA side.

I'm thinking about using this bluetooth module http://www.sparkfun.com/commerce/product_info.php?products_id=582
 
How many people have an iPhone and would be interested in a iPhone app to interface via bluetooth with CA?

Poll here ---> http://endless-sphere.com/forums/viewtopic.php?f=5&t=13088
 
Apparently bluetooth serial port protocol is not available in the iPhone SDK, however, the iPhone does have WIFI and I'm thinking of using this devices to connect to the CA.

http://www.sparkfun.com/commerce/product_info.php?products_id=9290
[edit: I found a better module] http://site.gridconnect.com/docs/datasheets/rn-134-ds_GC.pdf

I think I might need to wire up a TTL to RS232 convertor between the CA and the WIFI module, does that sound right?

What about voltage? CA @ 5V, WIFI @ 3.3V, will the TTL to RS232 converter sort out voltage issues?
 
Anyone know if they would be suitable to sit between the CA and the Wifi module?

http://www.futurlec.com/Mini_RS232_TTL_5V.shtml

The concept is CA -->TTL-->Mini_RS232_TTL_5V -->RS232-->Wifly GSX Super -->TCP/IP-->iPhone/iPod Touch/PC

Do I need to do all that or can I just connect a 9V battery to the 5-12V power pins (see below) and just connect the CA to the RX and GND on the UART inputs of the wifly module
Screen shot 2009-09-20 at 9.29.34 PM.jpg
 
Hey Everyone,

I just wanted to get some help on programming my c/a

I purchased the pickit 2 programmer of ebay;

I have a cycle analyst; i think it could of been a beta version c/a with version 2.03 on it

I'm trying to program it to 2.1v

I have the wiring all sorted out; I also configured it to run 5v into the pic chip; setup the chip type; (basically used the programmer to go feature); however i can not program is with the c/a version 2.1

i get an error "programming failed at memory address 0x000000"

I can read the chip
I can erase the chip (at least thats what it says it does)
However i can not write to it; or use the blank check button

Am i missing something here?

-steveo
 
Hey Everyone,

I managed to program my c/a today with version 2.1 beta 3; :D

However, not all is good news :roll: , I accidently plugged in the c/a port backwards ... this all happened because i don't have to propper male end on my c/a ...

the c/a still works fine, however i have no speed reading what so ever .. and this was to whole reason i re-programed my c/a lol .. 2.01v does not go above 14 pole motor!!!

I used about 22v when this happened .. could anyone pin point, if possible, what i could of possibly damaged?, I've checked for broken wires already, and all wiring it fine.

p.s. I installed the mp lab program, then i used the programming software that came with my pic kit 2 to flash, and this time it worked!! ... maybe i needed some drivers or something :|

-steveo
 
nutsandvolts said:
Cool that it works steveo.

You now have the controller speed output connected to the SP (speed) pad on CA, is that right?
IIRC you were converting this from external speedo sensor to internal, do I have that right?

Hey

I have converted my c/a from external speedo & external shunt to a direct plug it, after i converted it i used it for a bit, and it was working perfectly with the old firmware, however, right now .. i got no speed displaying, everything else works great!..

-steveo
 
nutsandvolts said:
Justin's firmware source code, like all source code, has some default values. Those are all of your configuration settings plus whatever other unadvertized defaults he uses. When you flash the micro, some things will revert back to default values. So check all the settings. What do you have for number of poles etc? It is always best to record ALL of your CA settings before flashing, otherwise, you may end up with a different config without even knowing what changed. How about listing all your settings here, including the advanced settings?

Check the number of poles ... from CA manual ... For Direct Plug-in units, this should be set to the number of hall effect transitions per rotation of the wheel. Crystalyte 400 series hubs have 8 while the 5300 series hubs have 12. For units that use a speedometer sensor and spoke magnet, #poles should be set to 1, unless you have multiple magnets on the wheel. The #poles can range from 1-14. If your motor requires more than 14 poles, then you will have to compensate by reducing the wheel circumference.

Hey

I've defaulted all the setting in my c/a like poles/mm or wheel/shunt/lvc etc

however, speed will not work.

thanks
-steveo
 
Hey everyone,

does anyone know how to test the speed signal? I've flashed with beta 2 & beta 3 of 2.1 c/a... however no speed reading!!
-steveo
 
nutsandvolts said:
A scope would be good for looking at the speed signal, but since you're getting no speed reading at all, if you don't have a scope, perhaps just try a DVM on the wire going to the SP pad on CA to see if there is any signal.

Hey

I have gotten the chance to test with a DVM; the speed pad toggles between 0-5v when i move the motor by hand... when i give it throttle ... the voltage between speed pad & negative sits at approx 2.5v..... I compared these result with my working c/a .. and its the exact same readings!!!!!

-steveo
 
steveo said:
I have converted my c/a from external speedo & external shunt to a direct plug it, ...
-steveo


I try to connect the CA to BAC281 controller (GoldenMotor). So far I couldn't detect a current sensing circuit on the board (http://goldenmotor.com/SMF/index.php?topic=1151.0). In order to avoid a lossy and bulky shunt resistor I consider to install a hall sensor. Has anybody experience with http://www.allegromicro.com/en/Products/Part_Numbers/0756/index.asp ? I'm not sure if its analog output is compatible (or can be made compatible) with the CA shunt current sensing input?!
 
wildnrg said:
Anyone know if they would be suitable to sit between the CA and the Wifi module?

http://www.futurlec.com/Mini_RS232_TTL_5V.shtml

The concept is CA -->TTL-->Mini_RS232_TTL_5V -->RS232-->Wifly GSX Super -->TCP/IP-->iPhone/iPod Touch/PC

Do I need to do all that or can I just connect a 9V battery to the 5-12V power pins (see below) and just connect the CA to the RX and GND on the UART inputs of the wifly module

i missed this one. i have never tried it but the WiFi module does has solder connections that are TTL level. the output of the CA is TTL level so in theory it should work with a direct connection. no need for converters or anything. the GSX module would have to be set up for the correct data rates, but once that is done... it should work. practice may be a bit different.

should be an interresting app. a wireless link between an app running on an iphone on a peer to peer network. neat!

rick
 
https://web.archive.org/web/2022072....com/forums/viewtopic.php?f=2&t=7747&start=25

nutsandvolts on page #1 said:
#1

The Cycle Analyst Beta 2.1 firmware enables serial data output and has a few other new features. The serial data transmit signal is TTL rather than RS232 voltage level so must be converted using a level converter IC (MAX232 or similar) to communicate with an RS232 serial port. Many PCs and most laptops these days no longer have serial ports, in this situation a USB serial dongle can be used. I have the cycle analyst sending data to my laptop. Here are some pictures of the parts used.

Parts Used: Perfboard, MAX232C RS232 level converter IC, 1uF capacitors, RS232 cable, and RS232 to USB converter dongle.

Image

Basically all that is needed is TTL to RS232 level conversion for the data output, power for the conversion circuit is available on a pad labeled 5V on the cycle analyst board. Here's the little circuit to do the conversion. Normally I would use cheap electrolytic capacitors for level conversion, shown are expensive tantalum caps because those are what I had on hand. Here is the level converter circuit, as specified in the MAX232C data sheet.

Image

These are the pads where the circuit connects to cycle analyst.

Image

The USB serial dongle used is product UMC-201 which uses the FTDI FT232BM chipset. It "just works" on linux, of course it will work on windows too, if you install drivers.

On plugging in the USB Serial converter, the linux kernel reports:

usb 5-2: new full speed USB device using uhci_hcd and address 2
usb 5-2: configuration #1 chosen from 1 choice
usbcore: registered new interface driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
ftdi_sio 5-2:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 5-2: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new interface driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

The data rate is configurable on cycle analyst in the advanced setup menu to be 1Hz or 5Hz. The serial communication settings are 9600 baud, 8 data bits, 1 stop bit, no parity, no flow control. Here is a picture of data from cycle analyst displayed in the minicom terminal program.

Image

The data sent over the serial port is Amp Hours, Voltage, Amperage, Speed, Distance.
After looking at the data I realized I needed to select the "Zero Amps" function in advanced setup as the amps were showing a negative value.

I have lots of ideas of what to do with this, one is I would like to overlay the data (speed, voltage, amperage, watts, amp hours) onto video camera view. Not sure how to do that yet but looking into it now. I'd like to also put another microcontroller in the mix, stamp the data with date/time/location/elevation from GPS and add temperature sensors.

--------------------------------

#2

Comparing the Beta 2.1 setup options with the 2.0 manual to see what is new, there's only five new configurable items:

1) Serial Data Output (1Hz or 5Hz) - this is sample rate not data communication rate (9600 baud works for both 1Hz and 5Hz)
2) Set TotDist - This allows you to enter your distance from before you did "full reset" on changing batteries, nice!
3) Set TotAhr - This is the same thing but for total accumulated amp hours, to enter your prior total before full reset
4) Aux Voltage On or Off
5) Aux Thresh

If I recall correctly, Justin said that the aux voltage and threshold were added to allow different throttle configuration,
for example a current mode throttle, the details of which escapes me.

I have a QuickCam Pro 9000 and just compiled drivers (uvc-linux) and am now exploring options for overlaying the
cycle analyst data onto live video. Fortunately things like this are much easier in linux than windows, so I expect to
have that working fairly soon, although I'll start with some C code to read and parse the serial data.

One bug has been experienced so far in the Beta 2.1, for which I still don't know the cause, occassionally it gets into
some kind of loop where it keeps rebooting, and simple power cycling of the unit doesn't work if you are moving
because back EMF keeps it running and looping. It has only happened a few times and I've been running this beta
for a while now so it doesn't bother me, if it happens I just have to stop and power cycle the unit.

---------------------------------

#4

I have tried various linux distros including ubuntu but always go running back to slackware. The only thing I like better is linux from scratch, but its a lot of work to get a full system with x-windows and desktop running. That said, there's nothing like compiling a compiler and building the entire mess from source code!

I have explored some options for overlaying the cycle analyst data onto live video, there's a few quick hack ways like using ffmpeg with vhook to imlib2, or messing around with subtitles using menucoder, but I'm leaning towards using the video4linux API and writing the stats as text directly to frame buffer while writing each frame to video output. This way eveything would be in memory and not require disk activity for the overlaying of data onto video.

---------------------------------

#6

Sweet! New firmware. Thank you this is awesome. I like the changes, especially setting the battery cycles.
I was planning to pester you for the hex file anyways, for the second cycle analyst I have now.

This is the red one you sent, stocking stuffer thing (thanks!), it appears to be a different version of the
hardware, the newer one I purchased is marked DB2 Rev7 but this red cycle analyst doesn't have a
version number on the microcontroller pcb. I note however, that they both use the same PIC16F690
microcontroller.

Do you know if this new firmware will work on the older (red color, standalone version) of cycle analyst?
I see the PICkit2 kit at digikey for $66.35 CDN. That should be all I need to load the hex file, is that right?
http://search.digikey.com/scripts/DkSea ... V164120-ND

------------------------------------

#7

Hmmm the PICkit 2 kit would be easier for flashing but ...

The mplab software can be downloaded for free.
Looks like its easy to make a programming cable.

Also, it seems one can buy just the USB dongle programming cable for $46.44 CDN rather than the full PICkit 2 kit
http://search.digikey.com/scripts/DkSea ... G164120-ND


--------------------------------

#10

The required cable for flashing is specific to PIC microcontrollers. Your cable will not work as is, but could probably be adapted to work. You would have to look at some of the home brew PIC programmer cable schematics to figure that out, or read the microchip specs. It would be much easier to buy a PIC programmer dongle from microchip, digikey, or elsewhere, or to make a cable based on schematics (there are many schematics for PIC programmers on the web). The software to load the firmware (hex) file is called mplab, and its freely downloadable from microchip. Links to the software, programming cables, and schematics to make a cable are already in this thread, see above. The mplab software is a complete development environment (compiler, linker, assembler, etc) but we need it just for flashing (loading the compiled hex (binary) file onto the cycle analyst. I assume that there are other simpler flash loader programs people have written that will also work, but we know for sure mplab works (I have seen it done). With the USB programmer dongle that comes with the PICkit 2 kit (from microchip), there is an IC clip on the end of the cable. It clips right onto the cycle analyst pcb board, then it only takes a few seconds to load the new firmware. I got distracted from this work but definitely plan to work more on it. I will probably interface to another microcontroller with lots of storage (sd card) to save data for later loading to pc).
 
Back
Top