Maker Pro
Maker Pro

Bluetooth supply voltage

ami85t

Feb 19, 2014
71
Joined
Feb 19, 2014
Messages
71
Hi,
I'm trying to wire up a BT module RN42SM.
I have a battery of 9V and the recommended vin is 3.3v.
I tried using a Voltage divider and it turned out that the BT has a very
high resistance and for various values of resistor the voltage input to
the BT was epx. 1.5V.
only when I connected directly the 9V the BT turned on (led)
and became hot very quickly..
Is there a way of using the battery to connect to the BT without
ruining it? do I need to use some digital supply instead?

Thanks, Amitai
 

ami85t

Feb 19, 2014
71
Joined
Feb 19, 2014
Messages
71
Thanks.
I want to transmit data via UART to a Bluetooth module (RN42SM).
The BT works well - a PC manages to connect to it and send to it information and the red led of transmitting
on the BT turns on.
The problem is transmitting data via the Bluetooth which doesn't happen for some reason.
The connection of the VDD and the Vss is correct because the BT to PC communication works well.
I left the code of a bi-LED flicker as part of this code for checking that nothing went wrong in the meantime.

here's the code:

Code:
LIST P=PIC16F877
include <P16f877.inc>

	__CONFIG _LVP_OFF &_WDT_OFF &_PWRTE_OFF &_CP_OFF & _RC_OSC
; basic config values  Watchdog ON, Lvp OFF, XT OSC crystal 4mhz and below


		nop
reset:	goto		start
		org			0x04

start:
; configuration
;-----------------------------------

	  bcf		STATUS, IRP	 ; Indirect Addressing to Bank 0-1
;UART/*/*/      
	  bsf		STATUS,RP0	 ; bank 1
	  bcf		STATUS,RP1
		movlw    0xB2        		 ; master, transmit EN, sync mode, Transmit Shift Register empty
		movwf    TXSTA	       		; Baud Rate = Fosc/(4(SPBRG+1)) , BRGH (baud rate) ignored in sync
		
		; clrf     TRISC         		; making port C output (also for SPI) 
		bsf	 	TRISC, 6 
		bsf		TRISC, 7	
		
		movlw	 0x10		   		; = d"16" which corresponds to 15Kbps with 8MHz clock
		movwf	 SPBRG
	
	  bcf		STATUS,RP0	; bank 0
		movlw    0x80		  		; enable UART	
		movwf    RCSTA	
		 
;LED/*/*/
		bsf			STATUS, RP0		;bank 1
		clrf		TRISD
; end configuration --------------------------------------


;************ MAIN PROGRAM ***************
;*****************************************
		bcf		STATUS,RP0	; bank 0
		movlw	0x50
		movwf	FSR	

	fill_reg:	
		incf	INDF
		incf	FSR
		movlw	0x60
		subwf	FSR, W
		btfss	STATUS, Z
		goto	fill_reg
		
MAIN_loop:
			
;-----transmit_data
		movlw	0x50
		movwf	FSR								; indirect Addressing points on 0x21	
		
	transmit_data:
		movf	INDF, W
		movwf   TXREG					    	; writing to TXREG clears TXIF
        trans_wait2:	btfss	PIR1, TXIF		; wait for the frame to be transmitted
		goto	trans_wait2
		;call	DELAY

		incf	FSR, F
		movlw	0x60							;transmit for 16 sensors
		subwf	FSR, W
		btfss	STATUS, Z
		goto	transmit_data
	
	led_loop:
			movlw		0x02
			movwf		0x32
			movlw		0x02
			movwf		0x33
				
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY
			
			led_green:	
			bcf			PORTD,3
			bsf			PORTD,2		
			decfsz	    0x32, f
			goto		led_green
			
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY
			CALL		DELAY

			led_red:
			bcf			PORTD,2
			bsf			PORTD,3
			decfsz	    0x33, f
			goto		led_red
			
	goto		led_loop	
	
goto MAIN_loop
				
;******** END MAIN LOOP ********************		

DELAY:
		movlw	0xFF
		movwf	0x30
		movlw	0xFF
		movwf	0x31
	
		loopa:
		decfsz	0x30, f
		goto	loopa
		loopb:
		decfsz	0x31, f
		goto	loopb
		return

end
 

Attachments

  • WP_000057.jpg
    WP_000057.jpg
    153.6 KB · Views: 79

switychandra

Mar 26, 2014
3
Joined
Mar 26, 2014
Messages
3
Hi
If you connected your BT module directly to 9V, it is probably dead.
What you need is a voltage regulator. If you want to save energy, do not use use a linear,
but a switching (buck) converter. If you use a linear converter, you will loose 2/3 of
the battery power
 
Top