hi folks, first of all, sorry for my poor englisch. :-( i donīt understand a lot of hardware/electric, i am more a linux sysadmin. i want to realise a project and need some hardware. everybody told me to buy a foxboard, but the micro2440/mini2440 looks better. ok what i want to do? a want to check 6 1-wire DS18B20 temperature sensors, and log the temperature for graphing. depends on the temperature, i would like to switch a solenoid valve which works with 24 V/AC.(i need some relais they told me) with no elektric the valve is open, with electric the valve is closed. i didntīfind anything about 1-wire and mini2440 on the internet and here im forum. is it possible to connect the 1-wire sensors to the mini2440 out of the box, using some gpio like on this picture of the foxboard? (http://foxg20.acmesystems.it/lib/exe/fetch.php?media=tutorial:ds18b20_wi...) can i connect my relais for my valve on this board, and what do i need for that? in the future i also want to use this board as timer for 2 waterpumps(230V), more relais are needed. and finaly a got a power meters with S0 Interface, witch a would like to log the amount of electricity the pumps used. is all this posible with a mini/micro2440? i just want to know if i could use this all with a mini/micro2440 and what hardware do i need to buy as well, the rest under linux, reading,logging,graphing etc.. is not that problem i think. thanx in advance guys Peter
1-Wire and mini2440
Hi Peter It seems like you want to control room temperature in a home. The mini2440 will do all that you want, however it might be easier to develop using the micro2440. The I/O pins that are available are more than adequate, you will need to add a relay drive circuit for each relay needed. But the circuit is very simple, just a few resistors and a transistor for each. You will probably need an extra external power supply as each relay circuit will not be enough for the relay drivers. Good luck Phil
> can i connect my relais for my valve on this board, and what do i need > for that? Do you know the relay board from BusError (Michel Pollet) http://bliterness.blogspot.com/2009/05/mini2440-relay-board.html
Controlling some DS18B20 is pretty simple. But, to achieve this in a simple way, you'll have to recompile a kernel First of all, you must put some 1-wire drivers in your kernel. <b> W1_MASTER_GPIO=Y (1wire bus master) W1_SLAVE_THERM=Y (Thermal family implementation) </b> do it with a graphical configuration tool, this is the simplest way... Then edit linux-2.6.32.2/arch/arm/mach-s3c2440/mac-mini2440.c and add following structures ... <b> /* 1wire bus master */ static struct w1_gpio_platform_data w1_gpio_pdata = { .pin = S3C2410_GPF(0), .is_open_drain = 1, };</b> We can notice that S3C2410_GPF(0) is going to be your 1-wire bus pin ( <b> static struct platform_device s3c_device_w1 = { .name = "w1-gpio", .id = -1, .dev.platform_data = &w1_gpio_pdata, };</b> Find and Modify the strcuture below and add last Line static struct platform_device *mini2440_devices[] __initdata = { .... <b> &s3c_device_w1 </b> }; Then find and modify a last method aiming at initialize 1-wire bus pin static void __init mini2440_machine_init(void) { #if defined (LCD_WIDTH) s3c24xx_fb_set_platdata(&mini2440_fb_info); #endif s3c_i2c0_set_platdata(NULL); <b> /* setup 1 wire pins */ s3c2410_gpio_cfgpin(w1_gpio_pdata.pin, 1); </b> ..... Now, you just have to compile your kernel and download it into your card. Then, you'll just have to plug your ds18b20 to 3.3V Pin Gnd Pin and GPF0/EINT0 Pin 9 Then go and navigate into /sys/bus/w1...as mentionned in your link... Good luck
@Phil i want to control the outside- and water temperartur for my pool. when sunshine and solar ist hotter than by poolwater, bypass the filterwater over my solar with the solenoid valve. when no sunshine, and water under 27°C, switch the heating pump on please. and then logging of the the power meters of the heating pump. why do you mind the micro is better for me, the only difference i see is 2xDB9 and 3xUSB-A Host more. @Sebastien thx a lot for the info! then the 1-wire is no problem any more. @Tommy no i dont, can i buy it anywhere? #### ok 1-wire is solved for my understandings. relays? i saw a lot of stuff over usb etc.. on the internet/youtube. what will be the best bet for my little projekt, 1x24V and 2x230V to manage? what hardware do i need for the relays on the mini/micro 2440? a link or pic would be nice, so a elecric noob understand things a bit better. how do i connect the relays, over usb,rs232,40 pin System Bus, 34 pin GPIO, 10 pin Buttons ?? when i know what i all need for this on the 2440, i can order my board and hardware etc.. i got a friend who is a electric engineer, he help me afterwords with the soldering and resistors and transistor stuff. for the power meters with s0 interface i need a digital input where i can count the impulse on the interface. can i do that with the 1x A/D pot? thx peter
@Sebastien putting some 1-wire drivers in your kernel is ok musst i always patch the kernel to use some of the gpoi on this board? the relays is also connected over the gpioīs do i also have to patch the kernel again to use the gpois? i thought linux recognised all the onboard stuff(232/usb etc..) by booting. i donīt understand a lot of patching/writing driver for the kernel/board. i also donīt find a lot of infos on the web about all this stuff. mini2440 and 1-wire results in almost nothing. i am affraid that i stand there and dont get things running. donīt want to write programm etc. in C, just want to use a view bash/perl scripts over cron to get things going. thanks peter
For my ac pumps i am using this for a relay. http://www.mpja.com/prodinfo.asp?number=17157+RL 3v-30v switching 480v40a i have it running a 120v1.5a pump. Works great!!! I cannot wait to recompile the kernel with 1-wire built in. Thanks for the info.
hi mike thx for the link! itīs sorry to see that such nice infos like the patch for 1-wire, stand somewhere in a forum in one of thousand other postings. a good wiki with all this nice infos would be much better for all the mini2440 owners. we got a wiki on this site, why donīt they posted things like that over there for the community, and some more howtos etc... which linux do you use on your board? how do you control your relay? did you write something in C or something else? did you need to patch the kernel to achieve that all for your relay? i bought the board yesterday, shipping from china to germany take a coupple op days :-( greetings Peter
the postamn was there today with my board i try to compile the kernel with the 1-wire patch from sebastian above, but i am getting the following error CC arch/arm/mach-s3c2440/mach-mini2440.o arch/arm/mach-s3c2440/mach-mini2440.c:294: error: variable 'w1_gpio_pdata' has initializer but incomplete type arch/arm/mach-s3c2440/mach-mini2440.c:295: error: unknown field 'pin' specified in initializer arch/arm/mach-s3c2440/mach-mini2440.c:295: warning: excess elements in struct initializer arch/arm/mach-s3c2440/mach-mini2440.c:295: warning: (near initialization for 'w1_gpio_pdata') arch/arm/mach-s3c2440/mach-mini2440.c:296: error: unknown field 'is_open_drain' specified in initializer arch/arm/mach-s3c2440/mach-mini2440.c:296: warning: excess elements in struct initializer arch/arm/mach-s3c2440/mach-mini2440.c:296: warning: (near initialization for 'w1_gpio_pdata') arch/arm/mach-s3c2440/mach-mini2440.c: In function 'mini2440_init': arch/arm/mach-s3c2440/mach-mini2440.c:809: error: invalid use of undefined type 'struct w1_gpio_platform_data' make[1]: *** [arch/arm/mach-s3c2440/mach-mini2440.o] Fehler 1 ################################################################ i put this in the arch/arm/mach-s3c2440/mach-mini2440.c file, highlite my input with ## here in forum, in file without ;) ############################# lets go ######################### S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME | S3C2410_LCDCON5_PWREN), }, }; ################################ edit begin ######################### static struct w1_gpio_platform_data w1_gpio_pdata = { .pin = S3C2410_GPF(0), .is_open_drain = 1, }; static struct platform_device s3c_device_w1 = { .name = "w1-gpio", .id = -1, .dev.platform_data = &w1_gpio_pdata, }; ################################ edit stop ######################### /* todo - put into gpio header */ #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2)) #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2)) static struct s3c2410fb_mach_info mini2440_fb_info __initdata = { ######################### ######################### and lower somewhere this ######################### ######################### static struct platform_device *mini2440_devices[] = { &s3c_device_usb, &s3c_device_wdt, /* &s3c_device_adc,*/ /* ADC doesn't like living with touchscreen ! */ &s3c_device_i2c0, &s3c_device_rtc, &s3c_device_usbgadget, &mini2440_device_eth, &mini2440_led1, &mini2440_led2, &mini2440_led3, &mini2440_led4, &mini2440_button_device, &s3c_device_nand, &s3c_device_sdi, &s3c_device_iis, ###############edit##################### &s3c_device_w1, ###############edit##################### &mini2440_audio, /* &s3c_device_timer[0],*/ /* buzzer pwm, no API for it */ /* remaining devices are optional */ }; ######################### ######################### and lower somewhere this ######################### ######################### } s3c24xx_udc_set_platdata(&mini2440_udc_cfg); s3c_i2c0_set_platdata(NULL); ###########################edit##################### s3c2410_gpio_cfgpin(w1_gpio_pdata.pin, 1); ############################edit##################### i2c_register_board_info(0, mini2440_i2c_devs, ARRAY_SIZE(mini2440_i2c_devs)); #ifdef CONFIG_TOUCHSCREEN_S3C2410 if (features.done & FEATURE_TOUCH) set_s3c2410ts_info(&mini2440_ts_cfg); #endif ######################### ######################### where or what did i do wrong, anybody shin a lite on this for me please. greetings Peter
Hi Peter Very interesting, I am actually working on the same Project. :-) Got my system up and running, temperature sensors working fine. See you are also from Germany, maybe we can get in contact, or share our Information here with each other. Regards Rudolf
Hi after i modify mach-s3c2440 than i run make at /linux-2.6.32.2 I get mac-mini2440.o what should i do after i got this file?
you must build your new kernel (uImage) and load in to your boot partition on your device or sdcard, depends how you handlet it. greetings rudolf
Hi, I managed to get the DS18B20 working with the above mach-mini2440.c modification and kernel drivers activation. When processing to cat /sys/bus/devices/18.xxxxxx/w1_slave, I get correctly the answer 49 01 4b 46 7f ff 07 10 f6 : crc=f6 YES 49 01 4b 46 7f ff 07 10 f6 t=20562 Now, I would like to get the temperature in a C program and I'm a bit stuck. Should execute the cat command from my C program, then parse the answer to isolate the "YES" and the "20562" ? I have googled a bit, and I found OWFS. What's the use of this if the kernel already does the virtual file system? Should I use it with 1-wire driver only and not thermal driver? Thanks
#include <stdio.h> #include <stdlib.h> int main() { FILE *fdt; fdt = fopen("w1_slave","r"); char str[20]; char str2[20]; fscanf(fdt,"%*[^=],%*s=%*s%*s"); fscanf(fdt,"=%*s%s",str); fscanf(fdt,"%*[^=],%*s"); fscanf(fdt,"=%s",str2); printf("str=%s,str2=%s",str,str2); sleep(1000); }
hello, I tried these modifications on the mini6410, ofcourse I modified the code to say S3C64XX and it compiles fine. However my DS18B20s sensor is not recognized, under /sys/bus/w1/devices I only find W1 bus master. I tried using ports GPE1 and GPM0 but get the same result. when i do a "dmesg | grep 1-wire" the output is as follows: Driver for 1-wire Dallas network protocol. however neither W1 nor W1-gpio give any output (not loading?) Is there anything I'm missing or is the fact the touchscreen on the mini6410 is also 1-wire makes that no other pins can be configure to use 1-wire? kind regards
Great tutorial and it is compiling with no problem... Just don't forget to add #include <linux/w1-gpio.h> at the begging of linux-2.6.32.2/arch/arm/mach-s3c2440/mac-mini2440.c
Hi! Done all of the above for Tiny6410 (including differences from mini2440). Chose the pin, which is connected to the internal sensor module. Works it good. Thank you! Q: How to make so that I can connect multiple lines 1-wire (on different pins)? That line, and not the sensors to the same line.