+Vorticon Posted April 16, 2020 Share Posted April 16, 2020 Since my NanoPEB died, I decided to port the wireless weather station from the TI to the CC40. It was not trivial because it required access to the RS232 at the low level, but luckily the RS232 manual did include example code on how to do this. Obviously the very limited screen real estate makes the display less attractive, but it's still completely functional. Also the footprint will be much smaller and will keep my otherwise idle CC40 computer busy [Link to the original 2017 project can be found in the video description] For the curious, here's the BASIC code. The resident BASIC in the CC40 is definitely more capable than the standard TI BASIC, minus the graphic functions. 10 REM WIRELESS WEATHER STATION CONTROL PROGRAM 20 REM CC40 VERSION 30 REM BY WALID MAALOULI 40 REM APRIL 2020 80 REM SETUP RS232 AND SERVICE REQUESTS 100 CALL GETMEM(17,SRPABADDR) 110 CALL GETMEM(1,BUFFADDR) 120 CALL SPLIT(BUFFADDR,MSB,LSB) 130 CALL SPLIT(SRPABADDR+16,MSB2,LSB2) 140 CALL POKE(SRPABADDR,0,0,0,MSB2,LSB2,MSB,LSB,0,0,1,0,10,0,0,0,0,20) 150 CALL POKE(2056,MSB2,LSB2) 160 CALL POKE(BUFFADDR,5,10) 170 CALL EXEC(BUFFADDR) 180 CALL PEEK(256,IOCNTRL) 190 IOCNTRL=IOCNTRL OR 1 200 CALL POKE(256,IOCNTRL) 220 FOR I=1 TO 7:READ D$(I):NEXT I 230 DATA "SUN","MON","TUE","WED","THU","FRI","SAT" 290 OPEN #1,"20.B=9600,C=Y,P=N,D=8,E=N,T=W,O=N",INTERNAL,UPDATE,VARIABLE 1 300 CALL IO(20,8) 310 REM GET TIME AND DAY 320 PRINT #1,"C" 325 PAUSE(0.5) 330 CALL PEEK(SRPABADDR+2,SFLAG) 340 IF SFLAG=0 THEN 320 350 CALL PEEK(BUFFADDR,HOUR) 360 GOSUB 4000:IF SFLAG=0 THEN 320 390 CALL PEEK(BUFFADDR,MINUTE) 420 CALL PEEK(BUFFADDR,DOW) 430 GOSUB 4000:IF SFLAG=0 THEN 320 435 IF DOW<1 OR DOW>7 THEN GOSUB 4060:GOTO 320 450 CALL PEEK(BUFFADDR,DAY) 460 GOSUB 4000:IF SFLAG=0 THEN 320 480 CALL PEEK(BUFFADDR,MONTH) 490 GOSUB 4000:IF SFLAG=0 THEN 320 510 CALL PEEK(BUFFADDR,YEAR) 520 PRINT D$(DOW);MONTH;"/";DAY;"/";YEAR;" ";HOUR;":";MINUTE 530 GOSUB 4060 549 REM GET HUMIDITY 550 PRINT #1,"H" 555 PAUSE(0.5) 560 CALL PEEK(SRPABADDR+2,SFLAG) 570 IF SFLAG=0 THEN 550 580 CALL PEEK(BUFFADDR,HUMIDITY):PRINT "HUMIDITY:";HUMIDITY;"%" 590 GOSUB 4060 600 REM GET TEMPERATURE 610 PRINT #1,"T" 615 PAUSE(2) 620 CALL PEEK(SRPABADDR+2,SFLAG) 630 IF SFLAG=0 THEN 610 640 GOSUB 4110:IF SFLAG=0 THEN 610 650 TEMP=INT(N*9/5+32):PRINT "TEMP:";TEMP;"F" 660 GOSUB 4060 670 REM GET PRESSURE 690 PRINT #1,"P" 700 PAUSE(0.5) 710 CALL PEEK(SRPABADDR+2,SFLAG) 720 IF SFLAG=0 THEN 690 730 GOSUB 4110:IF SFLAG=0 THEN 690 740 PRESSURE=VAL(SEG$(STR$(N/1000),1,5)) 750 PRINT "PRESSURE:";PRESSURE;"KPA" 760 GOSUB 4060 770 REM GET WIND SPEED 780 PRINT #1,"W" 790 PAUSE(0.5) 800 CALL PEEK(SRPABADDR+2,SFLAG) 810 IF SFLAG=0 THEN 780 820 GOSUB 4110:IF SFLAG=0 THEN 780 830 WSPEED=N 840 PRINT "WIND SPEED";WSPEED;"MPH" 850 GOSUB 4060 860 REM GET WIND DIRECTION 870 PRINT #1,"D" 880 PAUSE(0.5) 890 CALL PEEK(SRPABADDR+2,SFLAG) 900 IF SFLAG=0 THEN 870 910 GOSUB 4110:IF SFLAG=0 THEN 870 920 WDIR=N 930 PRINT "WIND DIRECTION:";WDIR;"DEG" 940 GOSUB 4060 950 REM GET RAIN FALL 960 PRINT #1,"R" 970 PAUSE(0.5) 980 CALL PEEK(SRPABADDR+2,SFLAG) 990 IF SFLAG=0 THEN 960 1000 GOSUB 4110:IF SFLAG=0 THEN 960 1010 DRAIN=DRAIN+N 1020 PRINT "RAIN TODAY:";DRAIN;"INCHES" 1030 GOSUB 4060 1040 GOTO 320 3990 REM CHECK FOR INCOMING BYTE 4000 COUNTER=0 4010 CALL POKE(SRPABADDR+2,0) 4020 CALL PEEK(SRPABADDR+2,SFLAG) 4030 IF SFLAG=0 THEN COUNTER=COUNTER+1 ELSE RETURN 4040 IF COUNTER>50 THEN RETURN ELSE 4020 4050 REM RESET FILE 4060 CALL IO(20,9):CLOSE #1:PAUSE(5) 4070 OPEN #1,"20.B=9600,C=Y,P=N,D=8,E=N,T=W,O=N",UPDATE,VARIABLE 1 4080 CALL POKE(SRPABADDR+2,0):CALL IO(20,8) 4090 RETURN 4100 REM RECEIVE STRING ROUTINE 4110 CALL PEEK(BUFFADDR,LENGTH) 4115 IF LENGTH>10 THEN GOSUB 4060:RETURN 4120 FOR I=1 TO LENGTH 4130 GOSUB 4000:IF SFLAG=0 THEN RETURN 4140 CALL PEEK(BUFFADDR,D(I)) 4150 NEXT I 4160 N$="" 4170 FOR I=1 TO LENGTH:N$=N$&CHR$(D(I)):NEXT I 4175 IF N$="" THEN GOSUB 4060:RETURN 4180 N=VAL(N$) 4190 RETURN 5990 REM SPLIT UNSIGNED 16-BIT VALUE INTO MSB AND LSB 6000 SUB SPLIT(DATAVAL,MSB,LSB) 6010 MSB=INT(DATAVAL/256) 6020 LSB=DATAVAL-MSB*256 6030 SUBEND 9 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 17, 2020 Share Posted April 17, 2020 The final spot of the CC40 wireless weather station in a corner of my basement I am running the CC40 off of a wall wart with batteries as backup and I dimmed the LCD as much as possible as I am concerned about screen burn over time. 8 Quote Link to comment Share on other sites More sharing options...
JB Posted April 17, 2020 Share Posted April 17, 2020 Very nice! 1 Quote Link to comment Share on other sites More sharing options...
brain Posted June 4, 2020 Share Posted June 4, 2020 (edited) OK a few updates: Acadiel shipped me his unit and mine back. Mine was working, but it's a bit dodgy on the seating into the Arduino pins, so that was it's issue His had a miswire. Both fixed, and working. Acadiel introduced me to Stephen Reid, who worked on the Hex Bus line back in the day. He took the Arduino source and updated quite a few things. The code now handles drive access, serial access, and parallel port support. Code work is ongoing, and you can check progress at the github repo in the sreid_mods branch. As well, he added a true Arduino build. The files will compile both as native and Arduino. Manfred Korn has also been adding some features (verify, delete, timing fixes) Thanks to both folks for the coding help. It's much easier to get motivated to work on the code when others are working on it. Jim Edited June 4, 2020 by brain adding a reason 8 1 Quote Link to comment Share on other sites More sharing options...
+dhe Posted June 4, 2020 Share Posted June 4, 2020 So it sounds like the hardware is 100%? Quote Link to comment Share on other sites More sharing options...
brain Posted June 4, 2020 Share Posted June 4, 2020 1 hour ago, dhe said: So it sounds like the hardware is 100%? I don't think the HW was ever a concern, but it's the SW that was less robust in the past. HexBus is a pretty simple protocol, electrically. 2 Quote Link to comment Share on other sites More sharing options...
brain Posted June 10, 2020 Share Posted June 10, 2020 As noted, Stephen Reid has modified the cc40 project to build from the Arduino editor, which makes it easier to build and upload. So, here's what folks need to create their own unit: An Arduino Uno (Yes, a Nano or other that is Uno compatible will work, but start with an Uno): eBay option: https://www.ebay.com/itm/Arduino-Uno-R3-USB-Acrylic-Box-Enclosure-Transparent-Case-for-Arduino-Uno-R3/132940030524?hash=item1ef3d7e23c:m:m4lEBwtSZi0JjnWjh4QHRiA Official Option: https://store.arduino.cc/usa/arduino-uno-rev3 A SD card module: https://www.ebay.com/itm/For-Arduino-UNO-SD-Card-Logging-Recorder-Data-Logger-Module-Shield-New-DS1307/164212784718?hash=item263bd83e4e:g:jnoAAOSwby5exgRH The project itself: https://github.com/go4retro/HEXTIr/tree/sreid_mods The Arduino IDE (I know 1.8.12 works, so I'd recommend it: https://www.arduino.cc/en/main/software Download the files from github into a dir, and load up the src.ino file in the IDE. Ctrl U will build and upload the file to the UNO (You'll have to configure the IDE for UNO and for the right COM port). A FAT32 formatted SD card. A bit of wire and a 2x4 straight or right angle set of header pins. Now, before you can use the unit, you need to wire up a few things. Solder the 2x4 header as shown on the board. Place it along the edge if possible, for easier hookup. Solder WP to 9 Solder CD to 8 Solder L1 to 7 Solder the wires underneath the board as shown in the picture Done. Power up your Arduino and load/save files from device 100. 7 4 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted June 10, 2020 Share Posted June 10, 2020 I'm going to build one as soon as I get the SD card logger. It will be perfect for my CC40 wireless weather station base. Thank you for developing this much needed device! Quote Link to comment Share on other sites More sharing options...
+dhe Posted June 10, 2020 Share Posted June 10, 2020 Questions: 1) The board your soldering on, looks like it plugs in to an arduino? 2) What about the cable, that plugs bridges the deek-robot to the cc40's hexbus port? 1 Quote Link to comment Share on other sites More sharing options...
brain Posted June 11, 2020 Share Posted June 11, 2020 2 hours ago, dhe said: Questions: 1) The board your soldering on, looks like it plugs in to an arduino? 2) What about the cable, that plugs bridges the deek-robot to the cc40's hexbus port? 1) Yep. That's why you need to also get an Arduino UNO 2) I'm not sure the best way to replicate the cable, but I bought 2 2x4 IDC connectors (think IDE connections, but only 8 pins), had some flat ribbon cable to crimp them to, and I bought this: https://www.ebay.com/itm/10PCS-2X10-Pin-2-54-mm-Stackable-11mm-Long-Legs-Female-Header-For-Arduino-Shield/301724613213?hash=item4640303a5d:g:rhMAAOSwmrlUzYCZ and cut off the excess pins. I put that in the end of the IDC connector, and then plugged the entire thing into the cc40. No soldering involved, just a bit of construction. Alternatively, buy a cc40 modem or some other peripheral, which come with a cable. Quote Link to comment Share on other sites More sharing options...
+jedimatt42 Posted June 11, 2020 Share Posted June 11, 2020 Is this still accurate? https://github.com/go4retro/HEXTIr/blob/sreid_mods/pcb/Fritzing/HexBusSDUno_bb.png I ask, cause by the time I get around to this, I expect the postimg.cc pictures to be dead links. -- and then it dawns on me, github has dates... and it was just updated... so thanks! Quote Link to comment Share on other sites More sharing options...
brain Posted June 11, 2020 Share Posted June 11, 2020 Well, I'll put the pics on github as well. They don't format as well for forums. 2 1 Quote Link to comment Share on other sites More sharing options...
brain Posted June 21, 2020 Share Posted June 21, 2020 A few recent updates to the codebase: serial and printer now should work on both Arduino IDE build and native Makefile build All three of us have collectively implemented some catalog functionality. Manfred added an option to "old 100.$" a directory directly, while both Manfred and Stephen have a "open/input#" directory format implemented. I should have them all merged by end of day tomorrow or Monday. soft configuration capability being implemented RTC callable from cc40 (in Arduino IDE build) low power mode enabled when system not active (s_reid) Not sure if anyone is interested, but I set up a discord server for us to use in development: https://discord.gg/vvPCaAQ Jim 5 Quote Link to comment Share on other sites More sharing options...
brain Posted June 28, 2020 Share Posted June 28, 2020 main branch now has a "catalog" functionality, where one can snag the directory by doing old "100.$", courtesy of Manfred. Other functions are still in the sreid_mods branch, which I am planning to merge tomorrow. Jim 3 1 Quote Link to comment Share on other sites More sharing options...
+arcadeshopper Posted July 1, 2020 Share Posted July 1, 2020 followed the instructions above.. "Download the files from github into a dir, and load up the src.ino file in the IDE. Ctrl U will build and upload the file to the UNO (You'll have to configure the IDE for UNO and for the right COM port)." missing library for the clock which i figured out errors in the source code in that branch can't compile the sketch can you guys give us a branch to work with that works? also a list of libraries needed to be installed? Quote Link to comment Share on other sites More sharing options...
brain Posted July 1, 2020 Share Posted July 1, 2020 Hehe, one would start pulling files after I started merging in the latest code from the master branch. Try this commit: https://github.com/go4retro/HEXTIr/tree/2c82960fc5620fe769a3e3b767dd45c204074b0f I'm not as familiar with the Arduino port, but I didn't have to install any code. I did use 1.8.12 of the IDE, so perhaps it was all in there. Jim Quote Link to comment Share on other sites More sharing options...
+arcadeshopper Posted July 1, 2020 Share Posted July 1, 2020 Hehe, one would start pulling files after I started merging in the latest code from the master branch. Try this commit: https://github.com/go4retro/HEXTIr/tree/2c82960fc5620fe769a3e3b767dd45c204074b0f I'm not as familiar with the Arduino port, but I didn't have to install any code. I did use 1.8.12 of the IDE, so perhaps it was all in there. Jim You must have had the clock library already then.. I installed that version and had the problems. Thanks! I'll try that in the morningSent from my LM-G820 using Tapatalk Quote Link to comment Share on other sites More sharing options...
+arcadeshopper Posted July 1, 2020 Share Posted July 1, 2020 Arduino: 1.8.12 (Linux), Board: "Arduino Uno" In file included from sketch/debug.c:14:0: debug.h:13:35: error: expected identifier or '(' before 'do' # define debug_putc(x) do {} while(0) ^ sketch/debug.c:16:6: note: in expansion of macro 'debug_putc' void debug_putc(uint8_t data) { ^~~~~~~~~~ debug.h:13:41: error: expected identifier or '(' before 'while' # define debug_putc(x) do {} while(0) ^ sketch/debug.c:16:6: note: in expansion of macro 'debug_putc' void debug_putc(uint8_t data) { ^~~~~~~~~~ debug.h:14:35: error: expected identifier or '(' before 'do' # define debug_puthex(x) do {} while(0) ^ sketch/debug.c:26:6: note: in expansion of macro 'debug_puthex' void debug_puthex(uint8_t hex) { ^~~~~~~~~~~~ debug.h:14:41: error: expected identifier or '(' before 'while' # define debug_puthex(x) do {} while(0) ^ sketch/debug.c:26:6: note: in expansion of macro 'debug_puthex' void debug_puthex(uint8_t hex) { ^~~~~~~~~~~~ debug.c:35:24: error: macro "debug_putcrlf" passed 1 arguments, but takes just 0 void debug_putcrlf(void) { ^ debug.c:35:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token void debug_putcrlf(void) { ^ In file included from sketch/debug.c:14:0: debug.h:16:35: error: expected identifier or '(' before 'do' # define debug_puts(x) do {} while(0) ^ sketch/debug.c:41:6: note: in expansion of macro 'debug_puts' void debug_puts(const char *text) { ^~~~~~~~~~ debug.h:16:41: error: expected identifier or '(' before 'while' # define debug_puts(x) do {} while(0) ^ sketch/debug.c:41:6: note: in expansion of macro 'debug_puts' void debug_puts(const char *text) { ^~~~~~~~~~ debug.h:17:35: error: expected identifier or '(' before 'do' # define debug_puts_P(x) do {} while(0) ^ sketch/debug.c:48:6: note: in expansion of macro 'debug_puts_P' void debug_puts_P(const char *text) { ^~~~~~~~~~~~ debug.h:17:41: error: expected identifier or '(' before 'while' # define debug_puts_P(x) do {} while(0) ^ sketch/debug.c:48:6: note: in expansion of macro 'debug_puts_P' void debug_puts_P(const char *text) { ^~~~~~~~~~~~ debug.h:15:35: error: expected identifier or '(' before 'do' # define debug_trace(x,y,z) do {} while(0) ^ sketch/debug.c:57:6: note: in expansion of macro 'debug_trace' void debug_trace(void *ptr, uint16_t start, uint16_t len) { ^~~~~~~~~~~ debug.h:15:41: error: expected identifier or '(' before 'while' # define debug_trace(x,y,z) do {} while(0) ^ sketch/debug.c:57:6: note: in expansion of macro 'debug_trace' void debug_trace(void *ptr, uint16_t start, uint16_t len) { ^~~~~~~~~~~ exit status 1 expected identifier or '(' before 'do' This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. Quote Link to comment Share on other sites More sharing options...
brain Posted July 1, 2020 Share Posted July 1, 2020 (edited) Sorry, I thought that was a safe commit. Pull from Reid's master, which I know compiles from Arduino and runs (as that's his dev environment), and let me finish the merge of the code into my repo. Also, note that there's a been a change in wiring, which may not have been noted here. BAV is now on D2, not D7, and LED is on D7, not D2. This allows sleep functionality for the drive. https://github.com/sreid1960/HexTI Jim Edited July 23, 2020 by brain Fix error 1 Quote Link to comment Share on other sites More sharing options...
+arcadeshopper Posted July 1, 2020 Share Posted July 1, 2020 ok was able to compile and flash from the original link in the instructions once i got the correct library for the clock in Quote Link to comment Share on other sites More sharing options...
+arcadeshopper Posted July 1, 2020 Share Posted July 1, 2020 ok for everyone else not in the discord, its working now for me I can save load and catalog the drive - took doing some direct programming of the uno with a hex file instead of using the ide.. and it helps if i solder on the ground wire.. pinout for the header connector is the key goes "up" 1 1 Quote Link to comment Share on other sites More sharing options...
brain Posted July 2, 2020 Share Posted July 2, 2020 The Arduino IDE sketch should work as well, but most of the Arduino UNO SD shields have a DS1307 RTC, not a DS3231, which the Arduino sketch expects. So, to address that, comment out the "#define INCLUDE_CLOCK line in config.h and sompile the sketch. The Discord channel does have the native compile, which supports the DS1307 as well as the DS3231 (and PCF8583), but it requires avrdude to load into the Arduino. Catalog does work on the native compile (I'm still working on merging it into the Arduino sketch), so keep that in mind. Jim 2 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 23, 2020 Share Posted July 23, 2020 So I finally got a chance to try this project (it took forever to get the SD shield), and unfortunately it is not working. I used 2 different known working Arduino Uno's, triple-checked the connections on the SD shield including point to point continuity and verified that all the shield pins are making proper contact with the Arduino. I had no issues compiling and transferring the software to the Arduino (I did have to manually install the DS3231 library first though). I used the files from the GitHub link in post #519 above. When the device is connected to the CC40 via a proper Hexbux cable and I save a file using SAVE "100.TEST", the IO indicator turns on and the computer hangs until I reset the Arduino at which point I get an I/O ERROR 255. Clearly a communication issue. When connecting the Arduino with the SD shield to a terminal console, I get just a blank screen with no activity whatsoever. Incidentally, the LED (L1) is always on, which I think should not be the case. Any thoughts? I should also mention that the SD shield construction is pretty shoddy, so I wouldn't be too surprised if it was the source of the troubles... Quote Link to comment Share on other sites More sharing options...
KlausO Posted July 23, 2020 Share Posted July 23, 2020 #519 say since today: „BAV is now on D2, not D7, and LED is on D7,not D2.“ You have to change your wiring for the current source-code. The file HEXTIr.bin from http://www.go4retro.com/downloads/HEXTIr/ works with my device and the „old“ wiring like yours. I have trouble with the thin pins of the SD-shild to connent to my cheap arduino clone. I take the connector apart and solder the shild on the arduino... 1 Quote Link to comment Share on other sites More sharing options...
brain Posted July 23, 2020 Share Posted July 23, 2020 I have found that the Arduino build sometimes hangs during the init of the DS1307 RTC (the Arduino code assumes a DS3231 RTC, while the native code has a driver for both). I tried to compile in the Arduino IDE for no clock, but got the same issue as you. I compiled two versions of the code for the arduino HW using the native make system, which works for me. If you are using the original wiring (LED on D2), then download and flash the _nopm.hex version (No Power Management). Otherwise, flash the other version, and let us know (or pop into Discord and we can troubleshoot real time). The issue is that once I flash the native code, it appears to configure the DS1307 so that a subsequent run with the Arduino code (from the sreid_mods branch of my repo, but I am sure the #519 as well) will work. So, testing is hampered in that way. http://www.go4retro.com/downloads/HEXTIr/ I will try to find a way to compile the Arduino sketch without the clock so it will work on these DS1307 shields (or just add the code to support the 1307 in the sketch. Jim Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.