Friday, September 7, 2012

To Butte and Back, the most useful apps and hardware

I took a trip from here in Michigan to Butte, Montana last week.  3600 miles.  It was a blast.  In the case of western South Dakota (near Wall), it was a blast of hot air.  It is bad when it is in the triple digits, worse when they are all the same digit (111F).  Several of my key apps came in useful, and I have a few other recommendations.  I was using my Samsung Galaxy Player 5.0 with my Mifi.  Several areas were below 3G so some of the things loaded slowly (you don't want the weather radar map animations), but the streaming radio worked fine.

Of course I'm running HarleyDroid and my SkyTraq AGPS app, but there are other logging navigation apps.

MyCast Weather - The radar maps kept me from either uselessly waiting for dark non-rainclouds to clear or getting soaked.  The "lite" version works, but it is worth getting the paid version, and you can then have a radar widget on the app screen.  One negative - the contrast in the roads and borders background is low-contrast, which isn't bad indoors, but not as good glancing at the handlebars.  And they don't have a combined cloud-radar map.

Astro Player - Best podcast, audiobook, and music player.  Bar none.  (I don't know of a difference between the regular and Nova - both work, and the unlock will unlock both) You can adjust the playback speed (but keep the pitch) so those sloooow hour of discussions go by in 40 minutes or less.  The auto playlist pointed at downloads (and the editable menu so Delete from SD is on top when I'm done) makes things so easy.  You can create homescreen icons for the different playlists.  One negative - I can't assign a playlist default speedup-slowdown, so if I switch to my music I have to change back to 1.0x playback, and then go back to 1.5x on a podcast.

Tune In Radio (pro) Keep up with your favorite radio or tune in local.  You can pause and it will save the broadcast so if you stop you won't miss anything.  You can even record (Pro version) a particularly interesting broadcast to listen to again later.

Google Maps Location and traffic - sometimes the slowdown is just for a half mile, sometimes the backup is very long so you should get off at the next exit and use some other road.  And you have navigation - where is the nearest restaurant chain with wifi?  Go right there.  Know if you need to be in the left or right lane.

Gas Buddy I could do a search on Google Maps, but this is faster and easier, just use the map view and you find fuel with some idea if it is cheaper at the next exit.

Mapdroyd Doesn't do routing, but you have full OFFLINE maps, so if you go so far off the beaten path that there are no cell towers to do the internet, you can still map out where you are.

GPS Test Displays GPS speed in big letters.  There is a paid "Plus" version that is probably worth getting but I haven't yet mainly because I'm thinking about redoing the displays on HarleyDroid.

Bluetooth GPS Since my HarleyDroid interface uses a 20Hz GPS, sometimes I need to check the reception, signal, and this will do it and even override the internal GPS.

Memory foam earphones These are what I use to listen.  They have different size in-ear cushions.  If they aren't blocking noise they are old - I have the same thing happen with ordinary foam earplugs.  These have a volume control inline so I can turn up the player and pull it back by moving the slide on the cord.  Broadcasts and podcasts don't have consistent volume.

One thing I don't have is a good app or widget that would give me time until sun/moon rise/set/phase - continually updating since going west or east will change the time.  I tried some, and even myCast gives the sunrise/set and moon phase in the currents screen, but there is nothing simple, direct, immediate.

I didn't have my camera mount so I didn't take a time-lapse on my Samsung HMX "flip" style camcorder.  Next time.

Thursday, August 16, 2012

Waterproofing supertape and super rubber bands

Silicone tape

The board is now under my speedometer, but if you were interested in how I encased it, simple.  I wrapped it in (clear) silicone self-fusing tape.  This is good for a lot of things.  Very heat resistant (I have some on my exhaust pipes to avoid scorching myself).  Weatherproof.  Coldproof.

One other very useful thing I use everywhere are silicone rubber bands, but they are in the kitchen department.

Silicone "rubber" bands

These can work as simple rubberbands, I have them holding my mifi to the power supply and to the handlebars, my saddlebags as tiedowns.

I haven't found anything that will erode them, they don't get weak, they work hot, cold, dry, wet.

Sunday, July 22, 2012

Reflections, or lack there of, on Black Shirts

If you were to check my closet, you would notice I have mostly black shirts.  T-shirts mostly.  And that drove the rest of my wardrobe to the dark side to make laundry easier.  There is a simple reason.

For a very long time I was sitting in front of computer monitors that when there were dark areas on the screen, you could see the reflection of whatever was in the room, and typically it would be me and whatever I was wearing, usually my shirt.  I've always avoided patterns or logos, picking primary colors, but they would still show up.  Basic black doesn't.  Even the backscatter from a brightly lit room can create problems.

On my motorcycle, a similar problem presented itself with the Samsung.  The original angle would show my face and the background - blue sky or clouds.  Or the sun.  The Samsung is fairly bright but not enough.  So I got a door screen hinge (they would go flush) and put the 3m superlock fasteners so I could position the screen nearly vertical, where it would reflect my (black) shirt.    After positioning it I braced it and used some ShoeGoo on the vertex of the hinge to hold it at that angle.  Now it is much easier to read, unless I'm turning and it reflects the road, but then it depends on if it is a "black top".  The angle makes things a bit less easy to read in general, but much clearer in sunlight or other bright conditions.

Saturday, July 7, 2012

The HarleyDroid Setup



The contrast was too high on the dial version of HarleyDroid.  If you look closely, on the right side of the top pic you can see my Mifi in plastic (the green power light).

I've done some mods on the code to add the GPS so that it will log, but need to do a few more things.  But I'm getting the bluetooth logs.  I don't really need the 20Hz GPS for the display as the GalaxyPlayer has one and it works very well, but when reviewing the data it helps having TPVs at 50mS intervals.  I may post some KMLs or logs if I have time to clean up the converter.  Apparently the Android verison of google earth can do SOME KML, but apparently this doesn't include those with time information ("When" XML).

The bottom pic shows the clip-on "case" I got at Best Buy.  On the back is some of those 3M locking "velcro-on-steroids" strips.  It isn't going to come off from any amount of vibration or shock, at least not unless it is sufficient to damage the Galaxy Player.  The wrist strap is connected to an S-biner so if it does it won't fall more than a few inches and hang.

Saturday, June 23, 2012

Rev3, I'd rather switch than fight

The current schematic, layout, and gerbers are at github.com/tz1 under the HarleyJ1850GPS section.

I replaced ONE of the power supplies with a switcher, which required larger caps and an inductor, but it works great.  Over 80% efficiency so when ON it draws less current.  It does not even get warm.  When it shuts off it drops to about 200uA, and over a few minutes drops to under 100uA.  update:  The GPS has a 0.2F capacitor as a second backup source but it is charged (and the GPS clock and static memory are kept alive) via the always on power source, so the current was probably an artifact of recharging the capacitor as it was unplugged for a while.


The left are the bare rev 3 boards.  Top right is rev2, you can see the heatsink, but probably not the large amount of solder and copper.  Bottom right is the rev 3 ready for my ride.

I can make it go lower and cut the part count  since there is a way to get the shutdown pin on the switcher to act as a latching toggle, e.g pull to ground with a 10K, up to the 3.3v out with a 10k.  When on, the 3.3v will keep it on, when off, it will be grounded.  Then use a transistor to isolate and amplify incoming J1850 5v levels  to turn it on by putting it in series with the ground resistor, so it becomes "open" when J1850 happens.  Then use a/the ATtiny pin to pull it strongly to ground to turn it off.  I have some of this breadboarded, but I don't think I will do so for now

One alteration is I can put either a ceramic resonator or a crystal in the same space (with two capacitors adjacent for the crystal).  Using a 10ppm crystal from digikey, the PPS happens right at 1000 milliseconds, where the resonator (at room temp, etc.) was 1001.  This is probably overkill, but the cost difference is slight.

The earlier revision worked well enough, but got warm enough that if I did something like a conformal coating or even put it in a water-resistant box I would worry.  How do I get airflow around the heatsink and/or board.

One particular feature is you can use this as a pure bluetooth GPS (though you would need to remove the ATtiny to prevent shutdown).

The six pins are arranged as:

AtTiny TransmitAtTiny Receive
Bluetooth ReceiveGPS Transmit
Bluetooth TransmitGPS Receive

Normally the connections are BT TX to GPS RX, BT RX to AT TX, AT RX to GPS TX, so the GPS goes through the ATTiny to the bluetooth, but the BT transmit can control the GPS (to allow updating AGPS as an example). Without connectors, it allows it to be reprogrammed, e.g. name or pin changes or even baud rate on the bluetooth, or various configuration on the GPS. The jumper pattern for that (see the silkskreen) is:

| |
 _

To configure as direct bluetooth to GPS:

x x
 _
 _

One final discovery on another topic - some other things I take on my rides.  My 3g Mifi wouldn't charge except with special adapters.  I finally found out why.  I need to short the data lines on the USB going in for it to actually charge.  There may be some other USB magic if attached to a computer, but a dumb 5v charger needs them shorted.  The funky ID resistors like for the Apple iPod/Pad/Phone chargers won't work.

Monday, June 4, 2012

Rev2, Doh repeated.

Somehow when I checked the second revision of the GPS/J1850 I still managed to have the connector too far apart for the GPS, but I corrected that a bit by bending a header so it would go sideways and up.  I fixed it but probably did an undo somewhere.

The other big change was lots of copper so the board would act as a heat sink, and it seems to work, though I don't think I should try it if I'm going to be in Yuma, AZ.

Ultimately I need to use a buck switcher, and have one, but while researching, it is interesting that both have different quiescent or off current needs.  The L1211 is very low, much lower than a 7833 style, so I will probably keep that although I don't have to turn it off for the ATtiny.

The GPS module surprisingly takes 100mA.  The GPS unit itself should take under 50mA (more if in fast scan, but that is off).  The powered antenna takes 10mA, the rest might be from the LEDs or other things.

The Bluetooth module takes 40mA while paring, but it says it would drop to 8mA after it is communicating.  I can shut off the GPS until the bluetooth is paired if I wanted, but I worry about maintaining lock and the time a warmstart would take after the Bluetooth is back on.

The switcher should fix this anyway.

Monday, May 28, 2012

And more, now with Android

I modified BlueTerm to add logging the received data to a gzipped file (in downloads named BT-datetime.txt.gz).  I didn't originally have a WAKE_LOCK to keep the CPU on so it kept cutting out, and I had a hardware problem on the one board I built that gives the BT module apoplexy on occasion - the LED doesn't blink, it just goes off but the GPS is still working.

I think I resolved it and am getting good logs.  Still some rare J1850 errors.  And I need to port my KML converters and such, and sync the J1850 data with the GPS position data (the fix comes out some random number of milliseconds - usually in the hundreds - after the event given the PPS location).

I'm also using a 7805 to drop the voltage so the regulator on board won't overheat at the moment while I sort out the alternatives.  I can't just use a resistor since during crank the voltage drops too far and it shuts off long enough to stop the GPS and break the BT connection.  The 7805 leaks so instead of 100nA, it draws 2.5mA when idle.  I have a few ideas but it would be nice if there was a 3.3v switcher that efficiently downconverted 12v and would work with nanoAmps up to 150mA.

Wednesday, May 23, 2012

And it works, so far.

Adding some physically large resistors to drop the voltage helps, but I may need to adjust it as it seemed to dropout when the engine started.

There were still more bus errors than I like - it may be the handlebar gear display.  But I'm getting nearly all RPM messages which are around 60 milliseconds apart.  The GPS worked too, until near the end when the antenna was loose and it wouldn't get a lock.  The sparkfun heatsink worked.

I might have to break down and put a 7805 or some other regulator in front, but I hope the extra copper on the new boards will work.

One reason I don't care as much about the bluetooth latency is because it isn't very large and I'm including accurate timestamps.  The NMEA sentences from the GPS often have over 100mS delay from where they should be if the PPS was being used to sync them.  Now I have higher precision and can locate a J1850 message close to the physical point it occurred at.

That is one ride but it is as good as I was getting before.

Monday, May 21, 2012

Problems, Hard and Soft

I've been working on the GPS interface and finally sent out the next rev board.  The main difference is I put a lot of copper near the pins to keep the regulator for the bluetooth and GPS units cool.  I also got some heat sinks from Sparkfun.

I get a few bad J1850 messages in an hour's data - it is probably just a glitch on the bus, and there isn't really a pattern.  Many messages actually look good but the CRC is off, and I wrote a program to flip one bit at a time to see if maybe I should change the split for the pwm.

The bluetooth module failed yesterday in the middle of the ride, but the day before the connector came loose and blew the fuse (engine going off in the middle of a ride was disturbing).  I'm not sure what might have caused it, and the GPS still works.  I will be swapping something.

On the software end, the millisecond timestamp had a problem.  Every so often when computing the timestamp it would be far enough off so it would reset in the middle of the second.  Mostly near where the count would overflow, so it was probably a race condition between the timer overflow interrupt, so the high time counter might be out of sync.  I'm going to fix this by monitoring the TCNT and when the current one is less than the original, then increment the high time.  The TOVF interrupt will do a check as well as the COMPB interrupt set to 32768 so without any other traffic the upper time will increment.  Even if the interrupts are delayed, the values will be monotonically increasing until overflow so there won't be multiple increments.

Other than that the timestamp was very stable (though the resonator was slightly fast).

Sunday, May 20, 2012

Harley GPS/J1850: HW and SW probs, the art of embedded

SoftwarI am having a problem with the high word of the timing clock.   This is where the art of embedded comes in.  I plan on adding an OC2 that will do a fake check at 1024 and 32768+1024.  Increment the high word if it would result in an inversion (TCNT1 overflowed).  This will replace the TOVF1.

There are many race conditions, but most are not serious, unless you rely on the interrupt.

The hardware problem is that the power supply, dissipate-ing the drop frolm 12+ V to 3.3.v is causing problems.  The next layout has lots of copper for the hot tne to spread to.

So there will be a rev.  I've added a lot of copper, but need to add VIAs .  This will make soldering a problem.

The last two days were fun for riding - and for testing.  But remembering the logo, I blew a fuse (in the middle of nowhere), but had a spare.  I'm getting a lot closer.

Saturday, May 12, 2012

Aargh!!!

The HarleyJ1850GPS boards came in too.  There was one Oops, which I triple checked, but I didn't actually print out the gerbers to size, so the connector for the Sparkfun GPS module is .1 too wide.  I also missed two traces (I think I ripped them to fix something but didn't put them back - easy to repair though).  Some extra wide headers let the GPS fit.   I soldered the bluetooth in a way I can remove it later when I update the board.  Only problem so far is that 12v+ will overheat the switched regulator (in a socket, and I didn't think too much about thermal management, probably connecting the No-connects to the ground plane would help, but I may need a heat sink or switcher).

Even more annoying, all I had to do was select Print on the board editor, and it produces 1:1.

One strange thing, BatchPCB carved out the area under the Bluetooth module (the corner of the board was router-ed out).  On the BlueV they didn't.

Friday, May 11, 2012

First BlueV boards!

And it works!

Some of the parts from digikey (note some were already in my partbox, and there are substitutes)

R31422-ND (modular jacks, 2)
296-1365-1-ND (5v regulator)
497-7246-1-ND (3.3v regulator)
1n5817-TPCT-ND (schottky diode, 2)
490-1215-ND (20MHz ceramic resonator)

Monday, May 7, 2012

Missed something for so long - AIN1 v.s. ICP1 on Valentine one data pin

The ICP1 pin is not connected on the official Arduino Megas, however the AIN1 input is, and the the analog comparator can be linked to the ICP1 part of the timer.  There are a few more registers to set.  And although there is no A/D on the ATtiny4313, it does have this analog comparator.  I do remember reading about it in the data sheet...

There is a "legacy mode" in the V1, however if it doesn't use the concealed display, will only pull up to 1.4v.  The analog comparators on the ATtiny(2/)4313 and Arduino Megas can be set to use an internal 1.1v reference.  It would be the opposite polarity (if I understand the circuit), but that shouldn't be a problem.  This should also work for the software UART in ESP mode.  But this caused me to go Duh! as I probably should have done the design using AIN from the start - the ESP Hardware guide shows a comparator for this purpose, though I never planned to do anything with legacy.

But last night, I thought, "Can I detect the legacy mode" - yes, if the Concealed Display is on, I can see the full stream because it is 5v, so I can give a warning on the Mega program.  Then I thought, "Can I read the bits...".  Done.  Then I thought, "well the infDisplay packet is almost the bits...".

I am able to emulate ESP from the V1 legacy stream (see my latest mega irq code at github), but I don't think I can get the ATtiny4313 to send it over bluetooth, at least not without something like a relay since I would have to detach the 4313 TX pin to Bluetooth RX pin from the V1 data line since the transmission would interfere with the V1 data stream, and trying to push it out during the gaps would probably confuse other devices.

However if I want to go forward (or someone else does, it is opensource hardware), I could add the "pull down audio to mute" on a pin, and add switchable a CD level pullup on the data line so it could do mute and/or blank the display when it received commands to do so (though I do send out the TS Holdoff bit to indicate it isn't ready for commands - I would have to do something to indicate the infDisplay packet as emulated).


Saturday, May 5, 2012

Arduino Mega ADK to V1 HowTo

Pictures and Videos to come.

What you will need

You can get most things at Radio Shack

276-0129
Arduino Mega ADK (the Mega should also work but I plan on adding Android support so you might want the ADK). http://arduino.cc/en/Main/ArduinoBoardADK for more info

274-1569
5.5/2.1 Coax Plug (optional, but powering from the plug is easier and keeps it in ESP mode even if no USB, and will be needed for the Android version)

Standard old USB A to B cable - the one with the end that looks like a house or barn if you don't have one.

Things you might want to pick up if you don't have at home:
A Modular cord, or plugs and cable and crimper so you can do a "build your own".
Basic electronics tools (I can use a one-edged razor to strip wire, but you might want something a bit better).
Wire - solid or a kit to hook up wires to the connector on the Arduino board.
(optional but recommended) Basic soldering - a soldering iron and solder.

If there's a Lowes nearby, you might want to get the phone cables from them, as they are cheaper, and/or a dual modular jack.  RCA TP42662WHN, Lowes sku 303140, UPC 0-44476-06065-6.  This might be easier to wire - no cutting the modular cord - and will allow upstream accessories.

Hardware Setup

(I will describe the RCA jack setup below if you want to do it that way).

Get the modular cord.  I prefer to use the end such that if the cord is coming out to the right, and the latch is facing you and the connector pads are facing away from you, from top to bottom will be Yellow, Green, Red, and Black.   When plugged into the accessory jack, this will make Red the vehicle power, Green the ground, and Yellow the data line.

(Click on any picture to bring up a much larger, detailed version).

Cut the modular cable so that the end you want is a convenient length.  Strip several inches of the jacket off the Modular cable.  The Data wire will need to go to two pins, 18 (TX1)  and 49.  (Hint - I used a lighter to burn/melt the insulation in a middle area and the end so I had two wires.  A bit of solder made them stiff enough).


These have a yellow square in the image below.  If you aren't going to power the Arduino via the V1 power line, you can run the ground line where the green square is.  (Image from arduino.cc, modified to show connection points)


If everything is wired correctly, plugging the modular cord into the accessory jack and the barrel connector into the arduino, the power light should come on.  (The picture is a bit sloppy, the black wire doesn't attach to anything, and the yellow wire is going to the two pins in the above image.



Software Setup

Download the Arduino IDE at  http://arduino.cc/en/Main/Software  and install (it is a zip file with a folder, not an installer program).  If there is a problem, there are troubleshooting resources on this site, so if you have trouble programming or compiling, this should explain what is happening.

Get my code.  At https://github.com/tz1/bluev there is a "Zip" button on the upper left that is the easiest.  It will download everything as a .zip file.

Programming the Arduino

Unpack the Arduino software folder into a convenient location (arduino-1.0) and go into the folder and double-click "arduino.exe".  This will bring up the IDE but should also create a directory called "Arduino" in "My Documents" which is the sketchbook directory.  Open the zip file downloaded from github (tz1-bluev...zip) and copy the bluev_sketch into the sketchbook directory.  Quit the Arduino IDE.

Plug in the Arduino Mega ADK board using the USB cable.  Windows will ask for a driver, use the "manual" install and point into the arduino-1.0/drivers directory.  It should find and install the driver.

Go into the bluev_sketch folder and double click the bluev_sketch.ino file.  This should bring up the Arduino IDE.  Click the right arrow icon (upload) at top.  This should compile and upload to the Mega ADK board.  You might need to tell it which COM port the first time (the Tools->Serial Port menu is used to select which com port).  When it is finished (at the bottom it will say "Upload Finished"), go to the Tools menu and select "Serial Monitor".  This will open another window, to interact with the board, and "V1 Mega Tool" should appear at the top.  (If the V1 is hooked up and sending packets the user menu will appear).

OPTION: Dual Modular Jack Wiring (to allow upstream accessories)

Open the box


Pull the right side connector out and straighten the wires.


Connect them crosswise, i.e. Left Yellow to Right Black, Left Green to Right Red, Left Red to Right Green, Left Black to Right Yellow.
Reinsert the right side jack

Attach 3 (or 4) wires to the connectors, from top to bottom, Audio, Battery, Ground, Data.  The Left jack will go toward the V1 (on either side of the power connector).  The right one will go toward more accessories.  (if you want a quick remote switch, you can put this between power and the V1 and wire a switch between the battery wires).







 Here I have a cable, Black and Red are ground and battery, white is data, green is audio.


You can swap the modular jacks if they are wrong (there is a reverse polarity protection diode, so the power light will only work if the power from the accessory jack is going to the right one).

 
  Reattach the cover and run the wires to the Mega.



Thursday, May 3, 2012

V1 ESP via Arduino Mega is working

 If you are anxious to start playing with ESP, you only need an Arduino Mega (not the Uno, but you can use the "android ADK" version which I would recommend because I will probably do something interesting with it).

You can get these at some Radio Shack stores. Search Result You can also get the modular phone cord and wire and anything else you might need.

Arduino info is at Arduino - HomePage

At http://github.com/tz1/bluev I have the instructions in the ArduMega.HOWTO.txt file, and it uses bluev.ino, bluevirq.c and bluevmega.c which need to be put int a folder called "bluev" in your Arduino sketchbook. Then just compile and upload.

The wiring is fairly simple, though the DATA line will need to go to two pins. You just need a ground, but you can use vehicle power.

The program prints a menu and lets you alter most things.

It is GPLv3 if you want to use the source.

I don't have menu items to alter the Savvy yet.

Here is an example using the serial monitor:

V1MegaTool
A-alerts, I-infoscan, D-DefaultSweep, S-SetSweeps. T-transparent, U-userbytes V-ViewDisplay
#-FactDefault 1-DispOff 2-DispOn 3-MuteOn 4-Muteoff 5-AllBogeys 6-Logic 7-Advanced-Logic
=====INFOSCAN=====
V1 Version: V3.8930
V1 SerialNo: 24[redacted]
BattVolt: 13.15
UserSet: (default) 12_45_78AbCdE_GHJuU_L
UserSet: (changed) __3__6_______F_____t____
SweepSections:
+1/2 34774 - 36072
+2/2 33383 -:34770
MaxSweepIndex: 5 (+1 for number of definitions)
SweepDefinitions:
+1/6 Low:33900 High:34106
+2/6 Low:34180 High:34475
+3/6 Low:34563 High:34652
+4/6 Low:35467 High:35526
+5/6 Low: 0 High: 0
+6/6 Low: 0 High: 0
CD Version: C2.1300
RA Version: R2.1300
SV Version: S0.0099
SV SerialNo: S9[redacted].
SavvyStat: ThreshKPH:56 (unmu ena: throvrd):2
SavvyVehSpd: 0 kph
=====END INFOSCAN=====
A-alerts, I-infoscan, D-DefaultSweep, S-SetSweeps. T-transparent, U-userbytes V-ViewDisplay
#-FactDefault 1-DispOff 2-DispOn 3-MuteOn 4-Muteoff 5-AllBogeys 6-Logic 7-Advanced-Logic

Arduino trivia:  You need to make variables in interrupts "volatile".  init() {} is the first thing called in main so you can use that to integrate embedded (stand-alone) programs and have the environment compile and upload them for you.

Monday, April 30, 2012

Arduino v.s.AVR tool mystery - solved

UPDATE:

It worked, but I had to do some modifications.

I split out a bluev.ino which was really simple (its all at github).  I renamed my routines hwsetup and hwloop, and called them from the ino C++ setup and loop.  Otherwise bluevmega.c is almost the same.

The arduino main() calls void init(), so I had to put that in my C file to make sure stuff I didn't know about would get set.

The Arduino IDE creates a core.a library during the build process with things specific to the Arduino setup (i.e. the wire I2C, but not libc stuff like string, printf, etc.).  Only something unresolved will be pulled from the archive, so my init() is used.

A final problem is I needed to declare everything which was a static but outside functions as "volatile".  I have a number of things like "while( head == tail)" that apparently just turned into infinite loops without it under the Arduino compile system.  It doesn't do that natively.  I haven't found out why.

But in any case, if you have an ESP V1, you can get an Arduino Mega and use it to reprogram sweeps, view alerts, or  just view the settings.

----Original
On Saturday, I was able to paste my C code for the Mega V1 tool right into the Arduino IDE and it ran.

Today (Monday) after a refactor,, it seems to have a prescaler off or something else I can't pinpoint.  Maybe a background task that disables interrupts long enough to cause me to lose start bits.  I'm not sure.  But bluevmega.c works when I natively compile it, but not when I paste it into the Arduino IDE.  I'm getting junk out of my ICP bitbang UART.  It is seeing edges but the timing and results are all wrong.

I've added the ability to set a default sweep or add user defined sweeps.  See the V1 technical documentation for more info.


Saturday, April 28, 2012

Arduino Mega does V1 ESP

The Arduino Mega has two broken out input captures and 4 UARTS.  I'm using the main UART to USB to talk to the computer, UART1 (TX) to send data over ESP, and ICP4 to receive the stream.  When I receive a full character over ESP, I echo it over the main UART (TX0).  It receives packets to send over the main UART (RX0).  So my test programs all work.

The Mega has room for me to write a simple UI for setting the sweeps.  It is available at Radio Shack and many other places around the world.  Programming it is a bit more complicated since this is NOT in the form of a sketch.  You would need to find  "avrdude" and copy the command line I use to flash, modifying it for your system, and use the tools to compile manually (but I would put up a binary to save that step if/when I come up with something).

Code is up at my github site (github.com/tz1/bluev) - see the README.

Precisions, Decisions

The V1 interface is going well.  I'm documenting a few things at http://www.radardetectorforum.org/valentine-one/ but my github.com/tz1/bluev is where new stuff is posted.

I now have the concealed display, remote audio, and savvy, and everything is working with these too.  I even added untested code for the non-checksum ESP.

I have a new v1test program that grabs everything and displays alert data, and is architected so I can expand it to a feature complete tool.  Porting it to Java for Android shouldn't be too hard, though I might want to do the receive stream in a separate thread.

Only hiccup is the Concealed Display seems not to have a strong lowside driver or otherwise there is a ground shift significant enough to cause problems with anything beyond a short wire, and this is very visible on my scope.

But I am already thinking about the next revision of the hardware.  There are two things - do I add a 'press button' circuit - but I can do everything via ESP, and I want to switch to an 18.432Mhz resonator or maybe even a 10ppm crystal.  I don't know that either are truly necessary, but the spec talks in very precise timings (if it is really this tight I consider it a flawed design for something using UARTs - It would require maybe even higher precision than the better crystal, but I doubt the Saavy is using a tcxo or ocxo).

Another detail is you need to turn the transmit driver on and off.  The time slices are 45 characters (10 56.7kBaud bits) wide but it isn't clear where the guard times are for the turn-on and turn-off, nor if I should allow for 22 byte messages max (It requires a pause of one character time between bytes), or less.  I think the longest is 18 so far, but it is V1 which doesn't have a slice per se as it defines the timing.

Finally, I should ba able to do all this on an Arduino Mega, though not as a sketch.  I might try it so others can jumpstart as they would not need special hardware.

Thursday, April 26, 2012

Bluetooth module test and program fixture

I'm using some cheap standard bluetooth serial modules. I ordered them from one of the cheap China suppliers but one didn't work - after I soldered it down to a breakout board.

I have provisions for going directly to the serial lines on the boards I'm designing so I can reprogram them after they are soldered in, but if they are defective?  They would be a pain to desolder without risking the board.

So, I needed a fixture to test and initially program the modules - they probably will never change, but better before soldering them down.


There was already someone that did something similar:

Byron's Programmer (fixture)

He has even created a programmer so he can change the firmware.  But I couldn't find my pogo pins

At JoAnn fabrics and crafts and probably many other craft stores they have "Sculpey" which is like modeling clay but hardens in any oven.  There are probably other similar plastic that can harden in the oven.  I thought about some other materials, but I needed something that would be hard so the pins wouldn't move or wear bigger holes.

I had some already, and also got my favorite probe tool, the beading needle.  They can go through most insulation when you need to see signals where there is nothing otherwise exposed.

So I put one of the modules down on a flattened mount of Sculpey, placed the flash LED and the needles so they would not short (including inside the sculpey) but also make contact - they are at an angle and I pushed them inward slightly after I removed the bluetooth module.   Then it was bake at 275 for 15 minutes.  It became hard and solid.  I tried some foam core stuff, but it gets pushed and the holes get big so everything gets sloppy after one or two units.  I was able to do both an HC_05 master (including the force to 38400 baud mode with the pin on the LED side), and an HC_06 using a 3.3v FTDI breakout from SparkFun normally used for Arduino Pros

Saturday, April 21, 2012

Thaws and effects

As the weather improves, and Michigan has repealed its mandatory helmet law, it is time to continue development.

Two new projects, both will be opensource hardware and software.  I'll be brief now but update more later, when I get the first boards back (I'm doing DIPs first, but will switch to surface mount).

I've redone my J1850 interface to add a sparkfun Venus 638 20Hz GPS module with a very low power sleep mode that shuts off the GPS (but maintains the vbatt) and bluetooth so I can leave it on and use battery instead of accessory.  Thanks to Stelian Pop who is working on a parallel effort - he wrote HarleyDroid for the Android (source also at github), but has adapted my embedded code and added J1850 send to his.  Mine is receive only but merges the GPS and J1850 data and adds PPS and timestamps.

https://github.com/tz1/HarleyJ1850GPS

Also going back to the Valentine V1 radar detector (remember my earlier project for a visible beep?).  The newer models have ESP - Extended Serial Protocol, which itself is simple, but there is some subtle timing that must be done.  Since I had the J1850 code doing almost-a-uart on the ICP1 pin, I rewrote it to be a UART and implemented the spec so from my computer I can send requests and monitor what is being returned.

https://github.com/tz1/bluev

In both cases the target is ultimately Android.  I need to polish my Java skills and probably consume copious amounts of java to get the full apps going, but it will be better than my Chumby version for the GPS, and there are a lot of possibilities with the V1.